Linux Documentation
 help / color / mirror / Atom feed
* [PATCH] Documentation/admin-guide/README.rst: add a label for cross-referencing
From: Michael Rodin @ 2018-06-03 18:16 UTC (permalink / raw)
  To: corbet; +Cc: linux-doc, linux-kernel, Michael Rodin

Add a label to the top of the file to allow cross-referencing.
Currently it's not possible to cross-reference this file from
Documentation/process/howto.rst because of the missing label.

Signed-off-by: Michael Rodin <michael-git@rodin.online>
---
 Documentation/admin-guide/README.rst | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/admin-guide/README.rst b/Documentation/admin-guide/README.rst
index 02caa7efd5ef..15ea785b2dfa 100644
--- a/Documentation/admin-guide/README.rst
+++ b/Documentation/admin-guide/README.rst
@@ -1,3 +1,5 @@
+.. _readme:
+
 Linux kernel release 4.x <http://kernel.org/>
 =============================================
 
-- 
2.14.1

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH] Documentation/process/howto.rst: add a missing cross-reference
From: Michael Rodin @ 2018-06-03 18:17 UTC (permalink / raw)
  To: corbet; +Cc: linux-doc, linux-kernel, Michael Rodin

Add a missing cross-reference from Documentation/process/howto.rst
to Documentation/admin-guide/README.rst.

Signed-off-by: Michael Rodin <michael-git@rodin.online>
---
 Documentation/process/howto.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/process/howto.rst b/Documentation/process/howto.rst
index 3df55811b916..130bf0f48875 100644
--- a/Documentation/process/howto.rst
+++ b/Documentation/process/howto.rst
@@ -85,7 +85,7 @@ linux-api@vger.kernel.org.
 Here is a list of files that are in the kernel source tree that are
 required reading:
 
-  README
+  :ref:`Documentation/admin-guide/README.rst <readme>`
     This file gives a short background on the Linux kernel and describes
     what is necessary to do to configure and build the kernel.  People
     who are new to the kernel should start here.
-- 
2.14.1

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* Re: [PATCH v5 0/2] Add ThunderX2 SoC Performance Monitoring Unit driver
From: Ganapatrao Kulkarni @ 2018-06-04  4:04 UTC (permalink / raw)
  To: Ganapatrao Kulkarni, Mark Rutland
  Cc: linux-doc, LKML, linux-arm-kernel, Will Deacon, jnair,
	Robert Richter, Vadim.Lomovtsev, Jan.Glauber
In-Reply-To: <20180516045518.6876-1-ganapatrao.kulkarni@cavium.com>

Hi Mark,

can you please share your review comments?

On Wed, May 16, 2018 at 10:25 AM, Ganapatrao Kulkarni
<ganapatrao.kulkarni@cavium.com> wrote:
> This patchset adds PMU driver for Cavium's ThunderX2 SoC UNCORE devices.
> The SoC has PMU support in L3 cache controller (L3C) and in the
> DDR4 Memory Controller (DMC).
>
> v5:
>      -Incroporated review comments from Mark Rutland[2]
> v4:
>      -Incroporated review comments from Mark Rutland[1]
>
> [1] https://www.spinics.net/lists/arm-kernel/msg588563.html
> [2] https://lkml.org/lkml/2018/4/26/376
>
> v3:
>      - fixed warning reported by kbuild robot
>
> v2:
>      - rebased to 4.12-rc1
>      - Removed Arch VULCAN dependency.
>      - update SMC call parameters as per latest firmware.
>
> v1:
>      -Initial patch
>
> Ganapatrao Kulkarni (2):
>   perf: uncore: Adding documentation for ThunderX2 pmu uncore driver
>   ThunderX2: Add Cavium ThunderX2 SoC UNCORE PMU driver
>
>  Documentation/perf/thunderx2-pmu.txt |  66 +++
>  drivers/perf/Kconfig                 |   8 +
>  drivers/perf/Makefile                |   1 +
>  drivers/perf/thunderx2_pmu.c         | 965 +++++++++++++++++++++++++++++++++++
>  include/linux/cpuhotplug.h           |   1 +
>  5 files changed, 1041 insertions(+)
>  create mode 100644 Documentation/perf/thunderx2-pmu.txt
>  create mode 100644 drivers/perf/thunderx2_pmu.c
>
> --
> 2.9.4
>

thanks
Ganapat
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v4 01/10] i3c: Add core I3C infrastructure
From: Przemyslaw Gaj @ 2018-06-04  9:11 UTC (permalink / raw)
  To: Boris Brezillon, Wolfram Sang, linux-i2c@vger.kernel.org,
	Jonathan Corbet, linux-doc@vger.kernel.org, Greg Kroah-Hartman,
	Arnd Bergmann
  Cc: Przemyslaw Sroka, Arkadiusz Golec, Alan Douglas, Bartosz Folta,
	Damian Kos, Alicja Jurasik-Urbaniak, Cyprian Wronka,
	Suresh Punnoose, Rafal Ciepiela, Thomas Petazzoni, Nishanth Menon,
	Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Vitor Soares, Geert Uytterhoeven, Linus Walleij, Xiang Lin,
	linux-gpio@vger.kernel.org
In-Reply-To: <20180330074751.25987-2-boris.brezillon@bootlin.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2644 bytes --]

Hi Boris

It looks great, just one comment to DEFSLVS command:

On 6/4/18, 9:32 AM, "Boris Brezillon" <boris.brezillon@bootlin.com> wrote:

    +int i3c_master_defslvs_locked(struct i3c_master_controller *master)
    +{
    +	struct i3c_ccc_cmd_dest dest = {
    +		.addr = I3C_BROADCAST_ADDR,
    +	};
    +	struct i3c_ccc_cmd cmd = {
    +		.id = I3C_CCC_DEFSLVS,
    +		.dests = &dest,
    +		.ndests = 1,
    +	};
    +	struct i3c_ccc_defslvs *defslvs;
    +	struct i3c_ccc_dev_desc *desc;
    +	struct i3c_device *i3cdev;
    +	struct i2c_device *i2cdev;
    +	struct i3c_bus *bus;
    +	bool send = false;
    +	int ndevs = 0, ret;
    +
    +	if (!master)
    +		return -EINVAL;
    +
    +	bus = i3c_master_get_bus(master);
    +	i3c_bus_for_each_i3cdev(bus, i3cdev) {
    +		ndevs++;
    +		if (I3C_BCR_DEVICE_ROLE(i3cdev->info.bcr) == I3C_BCR_I3C_MASTER)
    +			send = true;
    +	}
    +
    +	/* No other master on the bus, skip DEFSLVS. */
    +	if (!send)
    +		return 0;
    +
    +	i3c_bus_for_each_i2cdev(bus, i2cdev)
    +		ndevs++;
    +
    +	dest.payload.len = sizeof(*defslvs) +
    +			   ((ndevs - 1) * sizeof(struct i3c_ccc_dev_desc));
    +	defslvs = kzalloc(dest.payload.len, GFP_KERNEL);
    +	if (!defslvs)
    +		return -ENOMEM;
    +
    +	dest.payload.data = defslvs;
    +
    +	defslvs->count = ndevs;
    +	defslvs->master.bcr = master->this->info.bcr;
    +	defslvs->master.dcr = master->this->info.dcr;
    +	defslvs->master.dyn_addr = master->this->info.dyn_addr;
    +	defslvs->master.static_addr = I3C_BROADCAST_ADDR;
    +
    +	desc = defslvs->slaves;
    +	i3c_bus_for_each_i2cdev(bus, i2cdev) {
    +		desc->lvr = i2cdev->lvr;
    +		desc->static_addr = i2cdev->info.addr;
    +		desc++;
    +	}
    +
    +	i3c_bus_for_each_i3cdev(bus, i3cdev) {
    +		/* Skip the I3C dev representing this master. */
    +		if (i3cdev == master->this)
    +			continue;
    +
    +		desc->bcr = i3cdev->info.bcr;
    +		desc->dcr = i3cdev->info.dcr;
    +		desc->dyn_addr = i3cdev->info.dyn_addr;
    +		desc->static_addr = i3cdev->info.static_addr;
    +		desc++;
    +	}
    +
    +	ret = i3c_master_send_ccc_cmd_locked(master, &cmd);
    +	kfree(defslvs);
    +
    +	return ret;
    +}

You should shift all the addresses (dynamic and static) one bit left. 
Addresses are stored on bits [7:1], this is described in MIPI spec, 
section 5.1.9.3.7 Define List of Slaves (DEFSLVS)

Regards,
Przemyslaw Gaj

N‹§²æìr¸›yúèšØb²X¬¶Ç§vØ^–)Þº{.nÇ+‰·¥Š{±v‡"žØ^n‡r¡ö¦zË\x1aëh™¨è­Ú&¢ø\x1e®G«éh®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿïêäz¹Þ–Šàþf£¢·hšˆ§~ˆmš

^ permalink raw reply

* Re: [PATCH v4 07/10] i3c: master: Add driver for Cadence IP
From: Przemyslaw Gaj @ 2018-06-04  9:24 UTC (permalink / raw)
  To: Boris Brezillon, Wolfram Sang, linux-i2c@vger.kernel.org,
	Jonathan Corbet, linux-doc@vger.kernel.org, Greg Kroah-Hartman,
	Arnd Bergmann
  Cc: Przemyslaw Sroka, Arkadiusz Golec, Alan Douglas, Bartosz Folta,
	Damian Kos, Alicja Jurasik-Urbaniak, Cyprian Wronka,
	Suresh Punnoose, Rafal Ciepiela, Thomas Petazzoni, Nishanth Menon,
	Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Vitor Soares, Geert Uytterhoeven, Linus Walleij, Xiang Lin,
	linux-gpio@vger.kernel.org
In-Reply-To: <20180330074751.25987-8-boris.brezillon@bootlin.com>

Hi Boris,

Few things regarding Cadence IP driver:

On 6/4/18, 9:31 AM, "Boris Brezillon" <boris.brezillon@bootlin.com> wrote:

    +static void cdns_i3c_master_handle_ibi(struct cdns_i3c_master *master,
    +				       u32 ibir)
    +{
    +	struct cdns_i3c_i2c_dev_data *data;
    +	bool data_consumed = false;
    +	struct i3c_ibi_slot *slot;
    +	u32 id = IBIR_SLVID(ibir);
    +	struct i3c_device *dev;
    +	int len, i, j;
    +	u8 *buf;
    +
    +	/*
    +	 * FIXME: maybe we should report the FIFO OVF errors to the upper
    +	 * layer.
    +	 */
    +	if (id >= master->ibi.num_slots || (ibir & IBIR_ERROR))
    +		goto out;
    +
    +	dev = master->ibi.slots[id];
    +	spin_lock(&master->ibi.lock);
    +
    +	data = i3c_device_get_master_data(dev);
    +	slot = i3c_generic_ibi_get_free_slot(data->ibi_pool);
    +	if (!slot)
    +		goto out_unlock;
    +
    +	buf = slot->data;
    +
    +	len = IBIR_XFER_BYTES(ibir);
    +	for (i = 0; i < IBIR_XFER_BYTES(ibir); i += 4) {
    +		u32 tmp = readl(master->regs + IBI_DATA_FIFO);
    +
    +		for (j = 0; j < 4 && i + j < dev->ibi->max_payload_len; j++)
    +			buf[i + j] = tmp >> (j * 8);
    +
    +	}
    +	slot->len = min_t(unsigned int, IBIR_XFER_BYTES(ibir),
    +			  dev->ibi->max_payload_len);
    +	i3c_master_queue_ibi(dev, slot);
    +	data_consumed = true;
    +
    +out_unlock:
    +	spin_unlock(&master->ibi.lock);
    +
    +out:
    +	/* Consume data from the FIFO if it's not been done already. */
    +	if (!data_consumed) {
    +		for (i = 0; i < IBIR_XFER_BYTES(ibir); i += 4)
    +			readl(master->regs + IBI_DATA_FIFO);
    +	}
    +}
    
len variable is unneeded.

    +static int cdns_i3c_master_probe(struct platform_device *pdev)
    +{
    +	struct cdns_i3c_master *master;
    +	struct resource *res;
    +	int ret, irq;
    +	u32 val;
    +
    +	master = devm_kzalloc(&pdev->dev, sizeof(*master), GFP_KERNEL);
    +	if (!master)
    +		return -ENOMEM;
    +
    +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
    +	master->regs = devm_ioremap_resource(&pdev->dev, res);
    +	if (IS_ERR(master->regs))
    +		return PTR_ERR(master->regs);
    +
    +	master->pclk = devm_clk_get(&pdev->dev, "pclk");
    +	if (IS_ERR(master->pclk))
    +		return PTR_ERR(master->pclk);
    +
    +	master->sysclk = devm_clk_get(&pdev->dev, "sysclk");
    +	if (IS_ERR(master->pclk))
    +		return PTR_ERR(master->pclk);
    +
    +	irq = platform_get_irq(pdev, 0);
    +	if (irq < 0)
    +		return irq;
    +
    +	ret = clk_prepare_enable(master->pclk);
    +	if (ret)
    +		return ret;
    +
    +	ret = clk_prepare_enable(master->sysclk);
    +	if (ret)
    +		goto err_disable_pclk;
    +
    +	if (readl(master->regs + DEV_ID) != DEV_ID_I3C_MASTER) {
    +		ret = -EINVAL;
    +		goto err_disable_sysclk;
    +	}
    +
    +	spin_lock_init(&master->xferqueue.lock);
    +	INIT_LIST_HEAD(&master->xferqueue.list);
    +
    +	INIT_WORK(&master->hj_work, cdns_i3c_master_hj);
    +	writel(0xffffffff, master->regs + MST_IDR);
    +	writel(0xffffffff, master->regs + SLV_IDR);
    +	ret = devm_request_irq(&pdev->dev, irq, cdns_i3c_master_interrupt, 0,
    +			       dev_name(&pdev->dev), master);
    +	if (ret)
    +		goto err_disable_sysclk;
    +
    +	platform_set_drvdata(pdev, master);
    +
    +	val = readl(master->regs + CONF_STATUS0);
    +
    +	/* Device ID0 is reserved to describe this master. */
    +	master->maxdevs = CONF_STATUS0_DEVS_NUM(val);
    +	master->free_rr_slots = GENMASK(master->maxdevs, 1);
    +
    +	val = readl(master->regs + CONF_STATUS1);
    +	master->caps.cmdfifodepth = CONF_STATUS1_CMD_DEPTH(val);
    +	master->caps.rxfifodepth = CONF_STATUS1_RX_DEPTH(val);
    +	master->caps.txfifodepth = CONF_STATUS1_TX_DEPTH(val);
    +	master->caps.ibirfifodepth = 16;

IBI fifo depth is hardcoded. You can read this value from CONF_STATUS0 register.

    +	master->caps.cmdrfifodepth = 16;

CMDR fifo depth is hardcoded. You can read this value from CONF_STATUS0 register also.

    +
    +	spin_lock_init(&master->ibi.lock);
    +	master->ibi.num_slots = CONF_STATUS1_IBI_HW_RES(val);
    +	master->ibi.slots = devm_kzalloc(&pdev->dev,
    +					 sizeof(*master->ibi.slots) *
    +					 master->ibi.num_slots,
    +					 GFP_KERNEL);
    +	if (!master->ibi.slots)
    +		goto err_disable_sysclk;
    +
    +	writel(IBIR_THR(1), master->regs + CMD_IBI_THR_CTRL);
    +	writel(MST_INT_IBIR_THR, master->regs + MST_IER);
    +	writel(DEVS_CTRL_DEV_CLR_ALL, master->regs + DEVS_CTRL);
    +
    +	ret = i3c_master_register(&master->base, &pdev->dev,
    +				  &cdns_i3c_master_ops, false);
    +	if (ret)
    +		goto err_disable_sysclk;
    +
    +	return 0;
    +
    +err_disable_sysclk:
    +	clk_disable_unprepare(master->sysclk);
    +
    +err_disable_pclk:
    +	clk_disable_unprepare(master->pclk);
    +
    +	return ret;
    +}
    
Regards,
Przemyslaw Gaj


^ permalink raw reply

* Re: [PATCH v1 2/2] arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS
From: gengdongjiu @ 2018-06-04  9:53 UTC (permalink / raw)
  To: Eric Northup
  Cc: rkrcmar, corbet, christoffer.dall, Marc Zyngier, linux,
	Catalin Marinas, will.deacon, KVM, linux-doc, james.morse,
	linux-arm-kernel, Linux Kernel Mailing List, linux-acpi
In-Reply-To: <CAG7+5M08R5MDHbR-oYK+un1jgGta2UfuaLaVG5Hf9qT7usHKfg@mail.gmail.com>


On 2018/6/2 5:22, Eric Northup wrote:
> On Wed, May 30, 2018 at 10:04 PM Dongjiu Geng <gengdongjiu@huawei.com> wrote:
>>
>> For the migrating VMs, user space may need to know the exception

[...]

>> +               __u8 pad[6];
>> +               __u64 serror_esr;
>> +       } exception;
>> +       __u32 reserved[12];
> 
> It will be easier to re-purpose this in the future if the field is
> reserved and is checked that it must be zero.  SET_VCPU_EVENTS would
> return EINVAL if reserved fields get used until a later meaning is
> defined for them.
Ok, thanks. I will check the reserved fields when calling SET_VCPU_EVENTS.

> 
>> +};
>> +
>>  /* If you need to interpret the index values, here is the key: */
>>  #define KVM_REG_ARM_COPROC_MASK                0x000000000FFF0000
>>  #define KVM_REG_ARM_COPROC_SHIFT       16
>> diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
>> index 56a0260..71d3841 100644
>> --- a/arch/arm64/kvm/guest.c
>> +++ b/arch/arm64/kvm/guest.c
>> @@ -289,6 +289,42 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
>>         return -EINVAL;
>>  }
>>
[...]
>> --
>> 2.7.4
>>
> 
> .
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v4 01/10] i3c: Add core I3C infrastructure
From: Boris Brezillon @ 2018-06-04 11:24 UTC (permalink / raw)
  To: Przemyslaw Gaj
  Cc: Wolfram Sang, linux-i2c@vger.kernel.org, Jonathan Corbet,
	linux-doc@vger.kernel.org, Greg Kroah-Hartman, Arnd Bergmann,
	Przemyslaw Sroka, Arkadiusz Golec, Alan Douglas, Bartosz Folta,
	Damian Kos, Alicja Jurasik-Urbaniak, Cyprian Wronka,
	Suresh Punnoose, Rafal Ciepiela, Thomas Petazzoni, Nishanth Menon,
	Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Vitor Soares, Geert Uytterhoeven, Linus Walleij, Xiang Lin,
	linux-gpio@vger.kernel.org
In-Reply-To: <EFF070CA-9C6C-4E9C-9CEF-45AAD02745BB@cadence.com>

On Mon, 4 Jun 2018 09:11:25 +0000
Przemyslaw Gaj <pgaj@cadence.com> wrote:

> Hi Boris
> 
> It looks great, just one comment to DEFSLVS command:
> 
> On 6/4/18, 9:32 AM, "Boris Brezillon" <boris.brezillon@bootlin.com> wrote:
> 
>     +int i3c_master_defslvs_locked(struct i3c_master_controller *master)
>     +{
>     +	struct i3c_ccc_cmd_dest dest = {
>     +		.addr = I3C_BROADCAST_ADDR,
>     +	};
>     +	struct i3c_ccc_cmd cmd = {
>     +		.id = I3C_CCC_DEFSLVS,
>     +		.dests = &dest,
>     +		.ndests = 1,
>     +	};
>     +	struct i3c_ccc_defslvs *defslvs;
>     +	struct i3c_ccc_dev_desc *desc;
>     +	struct i3c_device *i3cdev;
>     +	struct i2c_device *i2cdev;
>     +	struct i3c_bus *bus;
>     +	bool send = false;
>     +	int ndevs = 0, ret;
>     +
>     +	if (!master)
>     +		return -EINVAL;
>     +
>     +	bus = i3c_master_get_bus(master);
>     +	i3c_bus_for_each_i3cdev(bus, i3cdev) {
>     +		ndevs++;
>     +		if (I3C_BCR_DEVICE_ROLE(i3cdev->info.bcr) == I3C_BCR_I3C_MASTER)
>     +			send = true;
>     +	}
>     +
>     +	/* No other master on the bus, skip DEFSLVS. */
>     +	if (!send)
>     +		return 0;
>     +
>     +	i3c_bus_for_each_i2cdev(bus, i2cdev)
>     +		ndevs++;
>     +
>     +	dest.payload.len = sizeof(*defslvs) +
>     +			   ((ndevs - 1) * sizeof(struct i3c_ccc_dev_desc));
>     +	defslvs = kzalloc(dest.payload.len, GFP_KERNEL);
>     +	if (!defslvs)
>     +		return -ENOMEM;
>     +
>     +	dest.payload.data = defslvs;
>     +
>     +	defslvs->count = ndevs;
>     +	defslvs->master.bcr = master->this->info.bcr;
>     +	defslvs->master.dcr = master->this->info.dcr;
>     +	defslvs->master.dyn_addr = master->this->info.dyn_addr;
>     +	defslvs->master.static_addr = I3C_BROADCAST_ADDR;
>     +
>     +	desc = defslvs->slaves;
>     +	i3c_bus_for_each_i2cdev(bus, i2cdev) {
>     +		desc->lvr = i2cdev->lvr;
>     +		desc->static_addr = i2cdev->info.addr;
>     +		desc++;
>     +	}
>     +
>     +	i3c_bus_for_each_i3cdev(bus, i3cdev) {
>     +		/* Skip the I3C dev representing this master. */
>     +		if (i3cdev == master->this)
>     +			continue;
>     +
>     +		desc->bcr = i3cdev->info.bcr;
>     +		desc->dcr = i3cdev->info.dcr;
>     +		desc->dyn_addr = i3cdev->info.dyn_addr;
>     +		desc->static_addr = i3cdev->info.static_addr;
>     +		desc++;
>     +	}
>     +
>     +	ret = i3c_master_send_ccc_cmd_locked(master, &cmd);
>     +	kfree(defslvs);
>     +
>     +	return ret;
>     +}
> 
> You should shift all the addresses (dynamic and static) one bit left. 
> Addresses are stored on bits [7:1], this is described in MIPI spec, 
> section 5.1.9.3.7 Define List of Slaves (DEFSLVS)

Oops, indeed. I will fix that.

Thanks,

Boris
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v4 07/10] i3c: master: Add driver for Cadence IP
From: Boris Brezillon @ 2018-06-04 11:26 UTC (permalink / raw)
  To: Przemyslaw Gaj
  Cc: Wolfram Sang, linux-i2c@vger.kernel.org, Jonathan Corbet,
	linux-doc@vger.kernel.org, Greg Kroah-Hartman, Arnd Bergmann,
	Przemyslaw Sroka, Arkadiusz Golec, Alan Douglas, Bartosz Folta,
	Damian Kos, Alicja Jurasik-Urbaniak, Cyprian Wronka,
	Suresh Punnoose, Rafal Ciepiela, Thomas Petazzoni, Nishanth Menon,
	Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Vitor Soares, Geert Uytterhoeven, Linus Walleij, Xiang Lin,
	linux-gpio@vger.kernel.org
In-Reply-To: <9613475C-ECAE-4AD6-9C02-55C9214A6489@cadence.com>

Hi Przemek,

On Mon, 4 Jun 2018 09:24:51 +0000
Przemyslaw Gaj <pgaj@cadence.com> wrote:

> Hi Boris,
> 
> Few things regarding Cadence IP driver:
> 
> On 6/4/18, 9:31 AM, "Boris Brezillon" <boris.brezillon@bootlin.com> wrote:
> 
>     +static void cdns_i3c_master_handle_ibi(struct cdns_i3c_master *master,
>     +				       u32 ibir)
>     +{
>     +	struct cdns_i3c_i2c_dev_data *data;
>     +	bool data_consumed = false;
>     +	struct i3c_ibi_slot *slot;
>     +	u32 id = IBIR_SLVID(ibir);
>     +	struct i3c_device *dev;
>     +	int len, i, j;
>     +	u8 *buf;
>     +
>     +	/*
>     +	 * FIXME: maybe we should report the FIFO OVF errors to the upper
>     +	 * layer.
>     +	 */
>     +	if (id >= master->ibi.num_slots || (ibir & IBIR_ERROR))
>     +		goto out;
>     +
>     +	dev = master->ibi.slots[id];
>     +	spin_lock(&master->ibi.lock);
>     +
>     +	data = i3c_device_get_master_data(dev);
>     +	slot = i3c_generic_ibi_get_free_slot(data->ibi_pool);
>     +	if (!slot)
>     +		goto out_unlock;
>     +
>     +	buf = slot->data;
>     +
>     +	len = IBIR_XFER_BYTES(ibir);
>     +	for (i = 0; i < IBIR_XFER_BYTES(ibir); i += 4) {
>     +		u32 tmp = readl(master->regs + IBI_DATA_FIFO);
>     +
>     +		for (j = 0; j < 4 && i + j < dev->ibi->max_payload_len; j++)
>     +			buf[i + j] = tmp >> (j * 8);
>     +
>     +	}
>     +	slot->len = min_t(unsigned int, IBIR_XFER_BYTES(ibir),
>     +			  dev->ibi->max_payload_len);
>     +	i3c_master_queue_ibi(dev, slot);
>     +	data_consumed = true;
>     +
>     +out_unlock:
>     +	spin_unlock(&master->ibi.lock);
>     +
>     +out:
>     +	/* Consume data from the FIFO if it's not been done already. */
>     +	if (!data_consumed) {
>     +		for (i = 0; i < IBIR_XFER_BYTES(ibir); i += 4)
>     +			readl(master->regs + IBI_DATA_FIFO);
>     +	}
>     +}
>     
> len variable is unneeded.

Will get rid of len.

>     +
>     +	/* Device ID0 is reserved to describe this master. */
>     +	master->maxdevs = CONF_STATUS0_DEVS_NUM(val);
>     +	master->free_rr_slots = GENMASK(master->maxdevs, 1);
>     +
>     +	val = readl(master->regs + CONF_STATUS1);
>     +	master->caps.cmdfifodepth = CONF_STATUS1_CMD_DEPTH(val);
>     +	master->caps.rxfifodepth = CONF_STATUS1_RX_DEPTH(val);
>     +	master->caps.txfifodepth = CONF_STATUS1_TX_DEPTH(val);
>     +	master->caps.ibirfifodepth = 16;
> 
> IBI fifo depth is hardcoded. You can read this value from CONF_STATUS0 register.
> 
>     +	master->caps.cmdrfifodepth = 16;
> 
> CMDR fifo depth is hardcoded. You can read this value from CONF_STATUS0 register also.

Sure, I'll use the FIFO depth exposed in CONF_STATUS0.

Thanks,

Boris
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH v2 2/2] arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS
From: Dongjiu Geng @ 2018-06-04 19:45 UTC (permalink / raw)
  To: rkrcmar, corbet, christoffer.dall, marc.zyngier, linux,
	catalin.marinas, will.deacon, kvm, linux-doc, james.morse,
	gengdongjiu, linux-arm-kernel, linux-kernel, linux-acpi
In-Reply-To: <1528141542-44048-1-git-send-email-gengdongjiu@huawei.com>

For the migrating VMs, user space may need to know the exception
state. For example, in the machine A, KVM make an SError pending,
when migrate to B, KVM also needs to pend an SError.

This new IOCTL exports user-invisible states related to SError.
Together with appropriate user space changes, user space can get/set
the SError exception state to do migrate/snapshot/suspend.

Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
--
change since v1:
Address Marc's comments, thanks Marc's review
1. serror_has_esr always true when ARM64_HAS_RAS_EXTN is set
2. remove Spurious blank line in kvm_arm_vcpu_set_events()
3. rename pend_guest_serror() to kvm_set_sei_esr()
4. Make kvm_arm_vcpu_get_events() did all the work rather than having this split responsibility.
5.  using sizeof(events) instead of sizeof(struct kvm_vcpu_events)

this series patch is separated from https://www.spinics.net/lists/kvm/msg168917.html
The user space patch is here: https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg06965.html

change since V12:
1. change (vcpu->arch.hcr_el2 & HCR_VSE) to !!(vcpu->arch.hcr_el2 & HCR_VSE) in kvm_arm_vcpu_get_events()

Change since V11:
Address James's comments, thanks James
1. Align the struct of kvm_vcpu_events to 64 bytes
2. Avoid exposing the stale ESR value in the kvm_arm_vcpu_get_events()
3. Change variables 'injected' name to 'serror_pending' in the kvm_arm_vcpu_set_events()
4. Change to sizeof(events) from sizeof(struct kvm_vcpu_events) in kvm_arch_vcpu_ioctl()

Change since V10:
Address James's comments, thanks James
1. Merge the helper function with the user.
2. Move the ISS_MASK into pend_guest_serror() to clear top bits
3. Make kvm_vcpu_events struct align to 4 bytes
4. Add something check in the kvm_arm_vcpu_set_events()
5. Check kvm_arm_vcpu_get/set_events()'s return value.
6. Initialise kvm_vcpu_events to 0 so that padding transferred to user-space doesn't
   contain kernel stack.
---
 Documentation/virtual/kvm/api.txt    | 31 ++++++++++++++++++++++++++++---
 arch/arm/include/asm/kvm_host.h      |  6 ++++++
 arch/arm/kvm/guest.c                 | 12 ++++++++++++
 arch/arm64/include/asm/kvm_emulate.h |  5 +++++
 arch/arm64/include/asm/kvm_host.h    |  7 +++++++
 arch/arm64/include/uapi/asm/kvm.h    | 13 +++++++++++++
 arch/arm64/kvm/guest.c               | 36 ++++++++++++++++++++++++++++++++++++
 arch/arm64/kvm/inject_fault.c        |  6 +++---
 arch/arm64/kvm/reset.c               |  1 +
 virt/kvm/arm/arm.c                   | 19 +++++++++++++++++++
 10 files changed, 130 insertions(+), 6 deletions(-)

diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index fdac969..8896737 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -835,11 +835,13 @@ struct kvm_clock_data {
 
 Capability: KVM_CAP_VCPU_EVENTS
 Extended by: KVM_CAP_INTR_SHADOW
-Architectures: x86
+Architectures: x86, arm, arm64
 Type: vm ioctl
 Parameters: struct kvm_vcpu_event (out)
 Returns: 0 on success, -1 on error
 
+X86:
+
 Gets currently pending exceptions, interrupts, and NMIs as well as related
 states of the vcpu.
 
@@ -881,15 +883,32 @@ Only two fields are defined in the flags field:
 - KVM_VCPUEVENT_VALID_SMM may be set in the flags field to signal that
   smi contains a valid state.
 
+ARM, ARM64:
+
+Gets currently pending SError exceptions as well as related states of the vcpu.
+
+struct kvm_vcpu_events {
+	struct {
+		__u8 serror_pending;
+		__u8 serror_has_esr;
+		/* Align it to 8 bytes */
+		__u8 pad[6];
+		__u64 serror_esr;
+	} exception;
+	__u32 reserved[12];
+};
+
 4.32 KVM_SET_VCPU_EVENTS
 
-Capability: KVM_CAP_VCPU_EVENTS
+Capebility: KVM_CAP_VCPU_EVENTS
 Extended by: KVM_CAP_INTR_SHADOW
-Architectures: x86
+Architectures: x86, arm, arm64
 Type: vm ioctl
 Parameters: struct kvm_vcpu_event (in)
 Returns: 0 on success, -1 on error
 
+X86:
+
 Set pending exceptions, interrupts, and NMIs as well as related states of the
 vcpu.
 
@@ -910,6 +929,12 @@ shall be written into the VCPU.
 
 KVM_VCPUEVENT_VALID_SMM can only be set if KVM_CAP_X86_SMM is available.
 
+ARM, ARM64:
+
+Set pending SError exceptions as well as related states of the vcpu.
+
+See KVM_GET_VCPU_EVENTS for the data structure.
+
 
 4.33 KVM_GET_DEBUGREGS
 
diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index c7c28c8..39f9901 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -213,6 +213,12 @@ unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu);
 int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices);
 int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
 int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
+int kvm_arm_vcpu_get_events(struct kvm_vcpu *vcpu,
+			struct kvm_vcpu_events *events);
+
+int kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu,
+			struct kvm_vcpu_events *events);
+
 unsigned long kvm_call_hyp(void *hypfn, ...);
 void force_vm_exit(const cpumask_t *mask);
 
diff --git a/arch/arm/kvm/guest.c b/arch/arm/kvm/guest.c
index a18f33e..c685f0e 100644
--- a/arch/arm/kvm/guest.c
+++ b/arch/arm/kvm/guest.c
@@ -261,6 +261,18 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
 	return -EINVAL;
 }
 
+int kvm_arm_vcpu_get_events(struct kvm_vcpu *vcpu,
+			struct kvm_vcpu_events *events)
+{
+	return -EINVAL;
+}
+
+int kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu,
+			struct kvm_vcpu_events *events)
+{
+	return -EINVAL;
+}
+
 int __attribute_const__ kvm_target_cpu(void)
 {
 	switch (read_cpuid_part()) {
diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
index 1dab3a9..18f61ff 100644
--- a/arch/arm64/include/asm/kvm_emulate.h
+++ b/arch/arm64/include/asm/kvm_emulate.h
@@ -81,6 +81,11 @@ static inline unsigned long *vcpu_hcr(struct kvm_vcpu *vcpu)
 	return (unsigned long *)&vcpu->arch.hcr_el2;
 }
 
+static inline unsigned long vcpu_get_vsesr(struct kvm_vcpu *vcpu)
+{
+	return vcpu->arch.vsesr_el2;
+}
+
 static inline void vcpu_set_vsesr(struct kvm_vcpu *vcpu, u64 vsesr)
 {
 	vcpu->arch.vsesr_el2 = vsesr;
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 469de8a..357304a 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -335,6 +335,11 @@ unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu);
 int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices);
 int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
 int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
+int kvm_arm_vcpu_get_events(struct kvm_vcpu *vcpu,
+			struct kvm_vcpu_events *events);
+
+int kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu,
+			struct kvm_vcpu_events *events);
 
 #define KVM_ARCH_WANT_MMU_NOTIFIER
 int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
@@ -363,6 +368,8 @@ void handle_exit_early(struct kvm_vcpu *vcpu, struct kvm_run *run,
 int kvm_perf_init(void);
 int kvm_perf_teardown(void);
 
+void kvm_set_sei_esr(struct kvm_vcpu *vcpu, u64 syndrome);
+
 struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, unsigned long mpidr);
 
 void __kvm_set_tpidr_el2(u64 tpidr_el2);
diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h
index 04b3256..df4faee 100644
--- a/arch/arm64/include/uapi/asm/kvm.h
+++ b/arch/arm64/include/uapi/asm/kvm.h
@@ -39,6 +39,7 @@
 #define __KVM_HAVE_GUEST_DEBUG
 #define __KVM_HAVE_IRQ_LINE
 #define __KVM_HAVE_READONLY_MEM
+#define __KVM_HAVE_VCPU_EVENTS
 
 #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
 
@@ -153,6 +154,18 @@ struct kvm_sync_regs {
 struct kvm_arch_memory_slot {
 };
 
+/* for KVM_GET/SET_VCPU_EVENTS */
+struct kvm_vcpu_events {
+	struct {
+		__u8 serror_pending;
+		__u8 serror_has_esr;
+		/* Align it to 8 bytes */
+		__u8 pad[6];
+		__u64 serror_esr;
+	} exception;
+	__u32 reserved[12];
+};
+
 /* If you need to interpret the index values, here is the key: */
 #define KVM_REG_ARM_COPROC_MASK		0x000000000FFF0000
 #define KVM_REG_ARM_COPROC_SHIFT	16
diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
index 56a0260..542ec2d 100644
--- a/arch/arm64/kvm/guest.c
+++ b/arch/arm64/kvm/guest.c
@@ -289,6 +289,42 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
 	return -EINVAL;
 }
 
+int kvm_arm_vcpu_get_events(struct kvm_vcpu *vcpu,
+			struct kvm_vcpu_events *events)
+{
+	memset(&events, 0, sizeof(events));
+
+	events->exception.serror_pending = !!(vcpu->arch.hcr_el2 & HCR_VSE);
+	events->exception.serror_has_esr =
+					cpus_have_const_cap(ARM64_HAS_RAS_EXTN);
+
+	if (events->exception.serror_pending &&
+		events->exception.serror_has_esr)
+		events->exception.serror_esr = vcpu_get_vsesr(vcpu);
+	else
+		events->exception.serror_esr = 0;
+
+	return 0;
+}
+
+int kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu,
+			struct kvm_vcpu_events *events)
+{
+	bool serror_pending = events->exception.serror_pending;
+	bool has_esr = events->exception.serror_has_esr;
+
+	if (serror_pending && has_esr) {
+		if (!cpus_have_const_cap(ARM64_HAS_RAS_EXTN))
+			return -EINVAL;
+
+		kvm_set_sei_esr(vcpu, events->exception.serror_esr);
+	} else if (serror_pending) {
+		kvm_inject_vabt(vcpu);
+	}
+
+	return 0;
+}
+
 int __attribute_const__ kvm_target_cpu(void)
 {
 	unsigned long implementor = read_cpuid_implementor();
diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c
index d8e7165..a55e91d 100644
--- a/arch/arm64/kvm/inject_fault.c
+++ b/arch/arm64/kvm/inject_fault.c
@@ -164,9 +164,9 @@ void kvm_inject_undefined(struct kvm_vcpu *vcpu)
 		inject_undef64(vcpu);
 }
 
-static void pend_guest_serror(struct kvm_vcpu *vcpu, u64 esr)
+void kvm_set_sei_esr(struct kvm_vcpu *vcpu, u64 esr)
 {
-	vcpu_set_vsesr(vcpu, esr);
+	vcpu_set_vsesr(vcpu, esr & ESR_ELx_ISS_MASK);
 	*vcpu_hcr(vcpu) |= HCR_VSE;
 }
 
@@ -184,5 +184,5 @@ static void pend_guest_serror(struct kvm_vcpu *vcpu, u64 esr)
  */
 void kvm_inject_vabt(struct kvm_vcpu *vcpu)
 {
-	pend_guest_serror(vcpu, ESR_ELx_ISV);
+	kvm_set_sei_esr(vcpu, ESR_ELx_ISV);
 }
diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c
index 38c8a64..20e919a 100644
--- a/arch/arm64/kvm/reset.c
+++ b/arch/arm64/kvm/reset.c
@@ -82,6 +82,7 @@ int kvm_arch_dev_ioctl_check_extension(struct kvm *kvm, long ext)
 		break;
 	case KVM_CAP_SET_GUEST_DEBUG:
 	case KVM_CAP_VCPU_ATTRIBUTES:
+	case KVM_CAP_VCPU_EVENTS:
 		r = 1;
 		break;
 	default:
diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c
index a4c1b76..79ecba9 100644
--- a/virt/kvm/arm/arm.c
+++ b/virt/kvm/arm/arm.c
@@ -1107,6 +1107,25 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
 		r = kvm_arm_vcpu_has_attr(vcpu, &attr);
 		break;
 	}
+	case KVM_GET_VCPU_EVENTS: {
+		struct kvm_vcpu_events events;
+
+		if (kvm_arm_vcpu_get_events(vcpu, &events))
+			return -EINVAL;
+
+		if (copy_to_user(argp, &events, sizeof(events)))
+			return -EFAULT;
+
+		return 0;
+	}
+	case KVM_SET_VCPU_EVENTS: {
+		struct kvm_vcpu_events events;
+
+		if (copy_from_user(&events, argp, sizeof(events)))
+			return -EFAULT;
+
+		return kvm_arm_vcpu_set_events(vcpu, &events);
+	}
 	default:
 		r = -EINVAL;
 	}
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH v2 0/2] support to set VSESR_EL2 by user space
From: Dongjiu Geng @ 2018-06-04 19:45 UTC (permalink / raw)
  To: rkrcmar, corbet, christoffer.dall, marc.zyngier, linux,
	catalin.marinas, will.deacon, kvm, linux-doc, james.morse,
	gengdongjiu, linux-arm-kernel, linux-kernel, linux-acpi

This series patch is separated from https://www.spinics.net/lists/kvm/msg168917.html

1. Detect whether KVM can set set guest SError syndrome
2. Support to Set VSESR_EL2 and inject SError by user space.
3. Support live migration to keep SError pending state and VSESR_EL2 value

The user space patch is here: https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg06965.html

Dongjiu Geng (2):
  arm64: KVM: export the capability to set guest SError syndrome
  arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS

 Documentation/virtual/kvm/api.txt    | 42 +++++++++++++++++++++++++++++++++---
 arch/arm/include/asm/kvm_host.h      |  6 ++++++
 arch/arm/kvm/guest.c                 | 12 +++++++++++
 arch/arm64/include/asm/kvm_emulate.h |  5 +++++
 arch/arm64/include/asm/kvm_host.h    |  7 ++++++
 arch/arm64/include/uapi/asm/kvm.h    | 13 +++++++++++
 arch/arm64/kvm/guest.c               | 35 ++++++++++++++++++++++++++++++
 arch/arm64/kvm/inject_fault.c        |  6 +++---
 arch/arm64/kvm/reset.c               |  4 ++++
 include/uapi/linux/kvm.h             |  1 +
 virt/kvm/arm/arm.c                   | 19 ++++++++++++++++
 11 files changed, 144 insertions(+), 6 deletions(-)

-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH v2 1/2] arm64: KVM: export the capability to set guest SError syndrome
From: Dongjiu Geng @ 2018-06-04 19:45 UTC (permalink / raw)
  To: rkrcmar, corbet, christoffer.dall, marc.zyngier, linux,
	catalin.marinas, will.deacon, kvm, linux-doc, james.morse,
	gengdongjiu, linux-arm-kernel, linux-kernel, linux-acpi
In-Reply-To: <1528141542-44048-1-git-send-email-gengdongjiu@huawei.com>

For the arm64 RAS Extension, user space can inject a virtual-SError
with specified ESR. So user space needs to know whether KVM support
to inject such SError, this interface adds this query for this capability.

KVM will check whether system support RAS Extension, if supported, KVM
returns true to user space, otherwise returns false.

Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
Reviewed-by: James Morse <james.morse@arm.com>
---
 Documentation/virtual/kvm/api.txt | 11 +++++++++++
 arch/arm64/kvm/reset.c            |  3 +++
 include/uapi/linux/kvm.h          |  1 +
 3 files changed, 15 insertions(+)

diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index 758bf40..fdac969 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -4603,3 +4603,14 @@ Architectures: s390
 This capability indicates that kvm will implement the interfaces to handle
 reset, migration and nested KVM for branch prediction blocking. The stfle
 facility 82 should not be provided to the guest without this capability.
+
+8.14 KVM_CAP_ARM_SET_SERROR_ESR
+
+Architectures: arm, arm64
+
+This capability indicates that userspace can specify the syndrome value reported
+to the guest OS when guest takes a virtual SError interrupt exception.
+If KVM has this capability, userspace can only specify the ISS field for the ESR
+syndrome, it can not specify the EC field which is not under control by KVM.
+If this virtual SError is taken to EL1 using AArch64, this value will be reported
+in ISS filed of ESR_EL1.
diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c
index 3256b92..38c8a64 100644
--- a/arch/arm64/kvm/reset.c
+++ b/arch/arm64/kvm/reset.c
@@ -77,6 +77,9 @@ int kvm_arch_dev_ioctl_check_extension(struct kvm *kvm, long ext)
 	case KVM_CAP_ARM_PMU_V3:
 		r = kvm_arm_support_pmu_v3();
 		break;
+	case KVM_CAP_ARM_INJECT_SERROR_ESR:
+		r = cpus_have_const_cap(ARM64_HAS_RAS_EXTN);
+		break;
 	case KVM_CAP_SET_GUEST_DEBUG:
 	case KVM_CAP_VCPU_ATTRIBUTES:
 		r = 1;
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index b02c41e..e88f976 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -948,6 +948,7 @@ struct kvm_ppc_resize_hpt {
 #define KVM_CAP_S390_BPB 152
 #define KVM_CAP_GET_MSR_FEATURES 153
 #define KVM_CAP_HYPERV_EVENTFD 154
+#define KVM_CAP_ARM_INJECT_SERROR_ESR 155
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH] doc: update description of ceph mount option
From: Chengguang Xu @ 2018-06-04 12:10 UTC (permalink / raw)
  To: ceph-devel, linux-doc; +Cc: zyan, idryomov, corbet, Chengguang Xu

Based on code, default value of rsize/wsize is 16 MB.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
---
 Documentation/filesystems/ceph.txt | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/Documentation/filesystems/ceph.txt b/Documentation/filesystems/ceph.txt
index d7f011ddc150..8bf62240e10d 100644
--- a/Documentation/filesystems/ceph.txt
+++ b/Documentation/filesystems/ceph.txt
@@ -105,15 +105,13 @@ Mount Options
 	address its connection to the monitor originates from.
 
   wsize=X
-	Specify the maximum write size in bytes.  By default there is no
-	maximum.  Ceph will normally size writes based on the file stripe
-	size.
+	Specify the maximum write size in bytes.  Default: 16 MB.
 
   rsize=X
-	Specify the maximum read size in bytes.  Default: 64 MB.
+	Specify the maximum read size in bytes.  Default: 16 MB.
 
   rasize=X
-	Specify the maximum readahead.  Default: 8 MB.
+	Specify the maximum readahead size in bytes.  Default: 8 MB.
 
   mount_timeout=X
 	Specify the timeout value for mount (in seconds), in the case
-- 
2.17.1

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* Re: [PATCH] docs/admin-guide/mm: add high level concepts overview
From: Mike Rapoport @ 2018-06-04 12:22 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Jonathan Corbet, linux-doc, linux-mm, linux-kernel
In-Reply-To: <285dd950-0b25-dba3-60b6-ceac6075fb48@infradead.org>

Hi Randy,

Thanks for the review! I always have trouble with articles :)
The patch below addresses most of your comments.

On Fri, Jun 01, 2018 at 05:09:38PM -0700, Randy Dunlap wrote:
> On 05/29/2018 04:37 AM, Mike Rapoport wrote:
> > Hi,
> > 
> > From 2d3ec7ea101a66b1535d5bec4acfc1e0f737fd53 Mon Sep 17 00:00:00 2001
> > From: Mike Rapoport <rppt@linux.vnet.ibm.com>
> > Date: Tue, 29 May 2018 14:12:39 +0300
> > Subject: [PATCH] docs/admin-guide/mm: add high level concepts overview
> > 
> > The are terms that seem obvious to the mm developers, but may be somewhat

Huh, I afraid it's to late to change the commit message :(
 
>   There are [or: These are]
> 
> > obscure for, say, less involved readers.
> > 
> > The concepts overview can be seen as an "extended glossary" that introduces
> > such terms to the readers of the kernel documentation.
> > 
> > Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
> > ---
> >  Documentation/admin-guide/mm/concepts.rst | 222 ++++++++++++++++++++++++++++++
> >  Documentation/admin-guide/mm/index.rst    |   5 +
> >  2 files changed, 227 insertions(+)
> >  create mode 100644 Documentation/admin-guide/mm/concepts.rst
> > 
> > diff --git a/Documentation/admin-guide/mm/concepts.rst b/Documentation/admin-guide/mm/concepts.rst
> > new file mode 100644
> > index 0000000..291699c
> > --- /dev/null
> > +++ b/Documentation/admin-guide/mm/concepts.rst

[...]

> > +All this makes dealing directly with physical memory quite complex and
> > +to avoid this complexity a concept of virtual memory was developed.
> > +
> > +The virtual memory abstracts the details of physical memory from the
> 
>        virtual memory {system, implementation} abstracts
> 
> > +application software, allows to keep only needed information in the
> 
>                software, allowing the VM to keep only needed information in the
> 
> > +physical memory (demand paging) and provides a mechanism for the
> > +protection and controlled sharing of data between processes.
> > +

My intention was "virtual memory concept allows ... and provides ..."
I didn't want to repeat "concept", to I've just omitted it.

Somehow, I don't feel that "system" or "implementation" fit here...

> 
> -- 
> ~Randy
> 

-- 
Sincerely yours,
Mike.

From 60e74f6ef29789f22555c4fdbbb85215e506f6d0 Mon Sep 17 00:00:00 2001
From: Mike Rapoport <rppt@linux.vnet.ibm.com>
Date: Mon, 4 Jun 2018 15:09:54 +0300
Subject: [PATCH] docs/admin-guide/mm/concepts.rst: grammar fixups

The patch is mostly about adding 'a' and 'the' and updating indentation.

Suggested-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
---
 Documentation/admin-guide/mm/concepts.rst | 39 ++++++++++++++++---------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/Documentation/admin-guide/mm/concepts.rst b/Documentation/admin-guide/mm/concepts.rst
index 291699c..ab7a0f9 100644
--- a/Documentation/admin-guide/mm/concepts.rst
+++ b/Documentation/admin-guide/mm/concepts.rst
@@ -4,13 +4,13 @@
 Concepts overview
 =================
 
-The memory management in Linux is complex system that evolved over the
-years and included more and more functionality to support variety of
+The memory management in Linux is a complex system that evolved over the
+years and included more and more functionality to support a variety of
 systems from MMU-less microcontrollers to supercomputers. The memory
-management for systems without MMU is called ``nommu`` and it
+management for systems without an MMU is called ``nommu`` and it
 definitely deserves a dedicated document, which hopefully will be
 eventually written. Yet, although some of the concepts are the same,
-here we assume that MMU is available and CPU can translate a virtual
+here we assume that an MMU is available and a CPU can translate a virtual
 address to a physical address.
 
 .. contents:: :local:
@@ -21,10 +21,10 @@ Virtual Memory Primer
 The physical memory in a computer system is a limited resource and
 even for systems that support memory hotplug there is a hard limit on
 the amount of memory that can be installed. The physical memory is not
-necessary contiguous, it might be accessible as a set of distinct
+necessary contiguous; it might be accessible as a set of distinct
 address ranges. Besides, different CPU architectures, and even
-different implementations of the same architecture have different view
-how these address ranges defined.
+different implementations of the same architecture have different views
+of how these address ranges defined.
 
 All this makes dealing directly with physical memory quite complex and
 to avoid this complexity a concept of virtual memory was developed.
@@ -48,8 +48,9 @@ appropriate kernel configuration option.
 
 Each physical memory page can be mapped as one or more virtual
 pages. These mappings are described by page tables that allow
-translation from virtual address used by programs to real address in
-the physical memory. The page tables organized hierarchically.
+translation from a virtual address used by programs to the real
+address in the physical memory. The page tables are organized
+hierarchically.
 
 The tables at the lowest level of the hierarchy contain physical
 addresses of actual pages used by the software. The tables at higher
@@ -121,8 +122,8 @@ Nodes
 Many multi-processor machines are NUMA - Non-Uniform Memory Access -
 systems. In such systems the memory is arranged into banks that have
 different access latency depending on the "distance" from the
-processor. Each bank is referred as `node` and for each node Linux
-constructs an independent memory management subsystem. A node has it's
+processor. Each bank is referred as a `node` and for each node Linux
+constructs an independent memory management subsystem. A node has its
 own set of zones, lists of free and used pages and various statistics
 counters. You can find more details about NUMA in
 :ref:`Documentation/vm/numa.rst <numa>` and in
@@ -149,7 +150,7 @@ for program's stack and heap or by explicit calls to mmap(2) system
 call. Usually, the anonymous mappings only define virtual memory areas
 that the program is allowed to access. The read accesses will result
 in creation of a page table entry that references a special physical
-page filled with zeroes. When the program performs a write, regular
+page filled with zeroes. When the program performs a write, a regular
 physical page will be allocated to hold the written data. The page
 will be marked dirty and if the kernel will decide to repurpose it,
 the dirty page will be swapped out.
@@ -181,8 +182,8 @@ pressure.
 The process of freeing the reclaimable physical memory pages and
 repurposing them is called (surprise!) `reclaim`. Linux can reclaim
 pages either asynchronously or synchronously, depending on the state
-of the system. When system is not loaded, most of the memory is free
-and allocation request will be satisfied immediately from the free
+of the system. When the system is not loaded, most of the memory is free
+and allocation requests will be satisfied immediately from the free
 pages supply. As the load increases, the amount of the free pages goes
 down and when it reaches a certain threshold (high watermark), an
 allocation request will awaken the ``kswapd`` daemon. It will
@@ -190,7 +191,7 @@ asynchronously scan memory pages and either just free them if the data
 they contain is available elsewhere, or evict to the backing storage
 device (remember those dirty pages?). As memory usage increases even
 more and reaches another threshold - min watermark - an allocation
-will trigger the `direct reclaim`. In this case allocation is stalled
+will trigger `direct reclaim`. In this case allocation is stalled
 until enough memory pages are reclaimed to satisfy the request.
 
 Compaction
@@ -200,7 +201,7 @@ As the system runs, tasks allocate and free the memory and it becomes
 fragmented. Although with virtual memory it is possible to present
 scattered physical pages as virtually contiguous range, sometimes it is
 necessary to allocate large physically contiguous memory areas. Such
-need may arise, for instance, when a device driver requires large
+need may arise, for instance, when a device driver requires a large
 buffer for DMA, or when THP allocates a huge page. Memory `compaction`
 addresses the fragmentation issue. This mechanism moves occupied pages
 from the lower part of a memory zone to free pages in the upper part
@@ -208,13 +209,13 @@ of the zone. When a compaction scan is finished free pages are grouped
 together at the beginning of the zone and allocations of large
 physically contiguous areas become possible.
 
-Like reclaim, the compaction may happen asynchronously in ``kcompactd``
-daemon or synchronously as a result of memory allocation request.
+Like reclaim, the compaction may happen asynchronously in the ``kcompactd``
+daemon or synchronously as a result of a memory allocation request.
 
 OOM killer
 ==========
 
-It may happen, that on a loaded machine memory will be exhausted. When
+It may happen that on a loaded machine memory will be exhausted. When
 the kernel detects that the system runs out of memory (OOM) it invokes
 `OOM killer`. Its mission is simple: all it has to do is to select a
 task to sacrifice for the sake of the overall system health. The
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [GIT PULL] Documentation for 4.18
From: Jonathan Corbet @ 2018-06-04 13:10 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: LKML, linux-doc

The following changes since commit
6d08b06e67cd117f6992c46611dfb4ce267cd71e:

  Linux 4.17-rc2 (2018-04-22 19:20:09 -0700)

are available in the Git repository at:

  git://git.lwn.net/linux.git tags/docs-4.18

for you to fetch changes up to a49d9c0ae46e149a22aefa8251d07dddd5611851:

  Documentation: document hung_task_panic kernel parameter (2018-05-29 06:46:04 -0600)

----------------------------------------------------------------
There's been a fair amount of work in the docs tree this time around,
including:

 - Extensive RST conversions and organizational work in the
   memory-management docs thanks to Mike Rapoport.

 - An update of Documentation/features from Andrea Parri and a script to
   keep it updated.

 - Various LICENSES updates from Thomas, along with a script to check SPDX
   tags.

 - Work to fix dangling references to documentation files; this involved a
   fair number of one-liner comment changes outside of Documentation/

...and the usual list of documentation improvements, typo fixes, etc.

The comment changes led inevitably to a couple of minor merge conflicts
with fairly obvious resolutions.

Mauro has another big set of dangling-reference fixes treewide that I've
held back thus far; you may see that as an end-of-window request in the
hope of minimizing the obnoxiousness for others.

----------------------------------------------------------------
Anders Roxell (1):
      doc: dev-tools: kselftest.rst: update contributing new tests

Andrea Parri (7):
      Documentation/features: Add script that refreshes the arch support status files in place
      Documentation/features: Refresh the arch support status files in place
      Documentation/features/core: Add arch support status files for 'cBPF-JIT' and 'eBPF-JIT'
      Documentation/features/locking: Use '!RWSEM_GENERIC_SPINLOCK' as Kconfig for 'rwsem-optimized'
      Documentation/features/lib: Remove arch support status file for 'strncasecmp'
      Documentation/features/vm: Remove arch support status file for 'pte_special'
      Documentation: refcount-vs-atomic: Update reference to LKMM doc.

Christina Quast (1):
      Some files where renamed from .txt to .rst, but the Documentation was not fixed yet.

Daniel Vetter (1):
      doc: botching-up-ioctls: Make it clearer why structs must be padded

Dong Bo (1):
      vfio: fix documentation

Heikki Krogerus (1):
      Documentation: typec.rst: Use literal-block element with ascii art

Huang Ying (1):
      mm, THP, doc: Add document for thp_swpout/thp_swpout_fallback

Jonathan Corbet (6):
      Merge branch 'mm-rst' into docs-next
      Merge branch 'tglx-license' into docs-next
      Merge tag 'v4.17-rc2' into docs-next
      Merge branch 'features' into docs-next
      Revert "Documentation/features/vm: Remove arch support status file for 'pte_special'"
      docs: Use the kerneldoc comments for memalloc_no*()

Jonathan Neuschäfer (1):
      Documentation: gpio: driver: Fix a typo and some odd grammar

Justin Skists (1):
      Documentation/process/posting: wrap text at 80 cols

Konstantin Ryabitsev (1):
      Documentation/process: updates to the PGP guide

Masanari Iida (1):
      linux-next: ftrace/docs: Fix spelling typos in ftrace-users.rst

Mathieu Poirier (3):
      coresight: Remove obsolete reference to "owner" in CoreSight descriptor
      coresight: Add section for integration with the perf tools
      coresight: Grouping all perf tools oriented section together

Matthew Wilcox (1):
      Docs: tell maintainers to put [GIT PULL] in their subject lines

Mauro Carvalho Chehab (10):
      docs: */index.rst: Add newer documents to their respective index.rst
      docs: admin-guide: add bcache documentation
      docs: core-api: add cachetlb documentation
      docs: core-api: add circular-buffers documentation
      docs: driver-api: add clk documentation
      docs: admin-guide: add cgroup-v2 documentation
      w1: w1_io.c: fix a kernel-doc warning
      docs: uio-howto.rst: use a code block to solve a warning
      scripts/documentation-file-ref-check: rewrite it in perl with auto-fix mode
      docs: ranoops.rst: fix location of ramoops.txt

Michal Hocko (1):
      doc: document scope NOFS, NOIO APIs

Mike Rapoport (54):
      docs/vm: active_mm.txt convert to ReST format
      docs/vm: balance: convert to ReST format
      docs/vm: cleancache.txt: convert to ReST format
      docs/vm: frontswap.txt: convert to ReST format
      docs/vm: highmem.txt: convert to ReST format
      docs/vm: hmm.txt: convert to ReST format
      docs/vm: hugetlbpage.txt: convert to ReST format
      docs/vm: hugetlbfs_reserv.txt: convert to ReST format
      docs/vm: hwpoison.txt: convert to ReST format
      docs/vm: idle_page_tracking.txt: convert to ReST format
      docs/vm: ksm.txt: convert to ReST format
      docs/vm: mmu_notifier.txt: convert to ReST format
      docs/vm: numa_memory_policy.txt: convert to ReST format
      docs/vm: overcommit-accounting: convert to ReST format
      docs/vm: page_frags convert to ReST format
      docs/vm: numa: convert to ReST format
      docs/vm: pagemap.txt: convert to ReST format
      docs/vm: page_migration: convert to ReST format
      docs/vm: page_owner: convert to ReST format
      docs/vm: remap_file_pages.txt: conert to ReST format
      docs/vm: slub.txt: convert to ReST format
      docs/vm: soft-dirty.txt: convert to ReST format
      docs/vm: split_page_table_lock: convert to ReST format
      docs/vm: swap_numa.txt: convert to ReST format
      docs/vm: transhuge.txt: convert to ReST format
      docs/vm: unevictable-lru.txt: convert to ReST format
      docs/vm: userfaultfd.txt: convert to ReST format
      docs/vm: z3fold.txt: convert to ReST format
      docs/vm: zsmalloc.txt: convert to ReST format
      docs/vm: zswap.txt: convert to ReST format
      docs/vm: rename documentation files to .rst
      docs/vm: add index.rst and link MM documentation to top level index
      docs/vm: hugetlbpage: minor improvements
      docs/vm: hugetlbpage: move section about kernel development to hugetlbfs_reserv
      docs/vm: pagemap: formatting and spelling updates
      docs/vm: pagemap: change document title
      docs/admin-guide: introduce basic index for mm documentation
      docs/admin-guide/mm: start moving here files from Documentation/vm
      docs/admin-guide/mm: convert plain text cross references to hyperlinks
      mm/ksm: docs: extend overview comment and make it "DOC:"
      docs/vm: ksm: (mostly) formatting updates
      docs/vm: ksm: add "Design" section
      docs/vm: ksm: reshuffle text between "sysfs" and "design" sections
      docs/vm: ksm: update stable_node_chains_prune_millisecs description
      docs/vm: ksm: udpate description of stable_node_{dups,chains}
      docs/vm: ksm: split userspace interface to admin-guide/mm/ksm.rst
      docs/vm: numa_memory_policy: formatting and spelling updates
      docs/vm: numa_memory_policy: s/Linux memory policy/NUMA memory policy/
      docs/vm: move numa_memory_policy.rst to Documentation/admin-guide/mm
      docs/vm: transhuge: change sections order
      docs/vm: transhuge: minor updates
      docs/vm: transhuge: split userspace bits to admin-guide/mm/transhuge
      docs/vm: move ksm and transhuge from "user" to "internals" section.
      docs/admin-guide/mm: add high level concepts overview

Omar Sandoval (1):
      Documentation: document hung_task_panic kernel parameter

Randy Dunlap (3):
      documentation: core-api: rearrange a few kernel-api chapters and sections
      Documentation: driver-api: fix device_connection.rst kernel-doc error
      Documentation: block: cmdline-partition.txt fixes and additions

Steffen Maier (1):
      Documentation: ftrace: clarify filters with dynamic ftrace and graph

Thomas Gleixner (7):
      LICENSES/GPL2.0: Add GPL-2.0-only/or-later as valid identifiers
      LICENSES: Add X11 license
      LICENSES: Add Apache 2.0 license text
      LICENSES: Add CDDL-1.0 license text
      LICENSES: Add CC-BY-SA-4.0 license text
      LICENSES: Add Linux-OpenIB license text
      scripts: Add SPDX checker script

Thomas Hebb (1):
      Documentation: arm: clean up Marvell Berlin family info

Thymo van Beers (1):
      docs: kernel-parameters.txt: Fix whitespace

Tim Bird (1):
      docs: update kernel versions and dates in tables

 Documentation/00-INDEX                             |  10 -
 Documentation/ABI/stable/sysfs-devices-node        |   2 +-
 .../ABI/testing/sysfs-kernel-mm-hugepages          |   2 +-
 Documentation/ABI/testing/sysfs-kernel-mm-ksm      |   2 +-
 Documentation/ABI/testing/sysfs-kernel-slab        |   4 +-
 .../{bcache.txt => admin-guide/bcache.rst}         |   0
 .../{cgroup-v2.txt => admin-guide/cgroup-v2.rst}   |   0
 Documentation/admin-guide/index.rst                |   3 +
 Documentation/admin-guide/kernel-parameters.txt    | 160 ++++---
 Documentation/admin-guide/mm/concepts.rst          | 222 +++++++++
 .../mm/hugetlbpage.rst}                            | 263 +++++-----
 .../mm/idle_page_tracking.rst}                     |  56 ++-
 Documentation/admin-guide/mm/index.rst             |  36 ++
 Documentation/admin-guide/mm/ksm.rst               | 189 ++++++++
 .../admin-guide/mm/numa_memory_policy.rst          | 495 +++++++++++++++++++
 .../{vm/pagemap.txt => admin-guide/mm/pagemap.rst} | 184 +++----
 .../mm/soft-dirty.rst}                             |  20 +-
 Documentation/admin-guide/mm/transhuge.rst         | 418 ++++++++++++++++
 .../mm/userfaultfd.rst}                            |  66 +--
 Documentation/admin-guide/ramoops.rst              |   2 +-
 Documentation/arm/Marvell/README                   |  15 +-
 Documentation/block/cmdline-partition.txt          |  21 +-
 .../{cachetlb.txt => core-api/cachetlb.rst}        |   0
 .../circular-buffers.rst}                          |   0
 Documentation/core-api/gfp_mask-from-fs-io.rst     |  66 +++
 Documentation/core-api/index.rst                   |   3 +
 Documentation/core-api/kernel-api.rst              |  60 +--
 Documentation/core-api/refcount-vs-atomic.rst      |   2 +-
 Documentation/crypto/index.rst                     |   1 +
 Documentation/dev-tools/kasan.rst                  |   2 +-
 Documentation/dev-tools/kselftest.rst              |   5 +
 Documentation/{clk.txt => driver-api/clk.rst}      |   0
 Documentation/driver-api/device_connection.rst     |   2 +-
 Documentation/driver-api/gpio/driver.rst           |   6 +-
 Documentation/driver-api/index.rst                 |   2 +
 Documentation/driver-api/uio-howto.rst             |   3 +-
 Documentation/driver-api/usb/typec.rst             |   2 +-
 .../strncasecmp => core/cBPF-JIT}/arch-support.txt |  14 +-
 .../core/{BPF-JIT => eBPF-JIT}/arch-support.txt    |   8 +-
 .../core/generic-idle-thread/arch-support.txt      |   4 +-
 .../features/core/jump-labels/arch-support.txt     |   2 +
 .../features/core/tracehook/arch-support.txt       |   2 +
 .../features/debug/KASAN/arch-support.txt          |   4 +-
 .../debug/gcov-profile-all/arch-support.txt        |   2 +
 Documentation/features/debug/kgdb/arch-support.txt |   4 +-
 .../debug/kprobes-on-ftrace/arch-support.txt       |   2 +
 .../features/debug/kprobes/arch-support.txt        |   4 +-
 .../features/debug/kretprobes/arch-support.txt     |   4 +-
 .../features/debug/optprobes/arch-support.txt      |   4 +-
 .../features/debug/stackprotector/arch-support.txt |   2 +
 .../features/debug/uprobes/arch-support.txt        |   6 +-
 .../debug/user-ret-profiler/arch-support.txt       |   2 +
 .../features/io/dma-api-debug/arch-support.txt     |   2 +
 .../features/io/dma-contiguous/arch-support.txt    |   4 +-
 .../features/io/sg-chain/arch-support.txt          |   2 +
 .../locking/cmpxchg-local/arch-support.txt         |   4 +-
 .../features/locking/lockdep/arch-support.txt      |   4 +-
 .../locking/queued-rwlocks/arch-support.txt        |  10 +-
 .../locking/queued-spinlocks/arch-support.txt      |   8 +-
 .../locking/rwsem-optimized/arch-support.txt       |  10 +-
 .../features/perf/kprobes-event/arch-support.txt   |   6 +-
 .../features/perf/perf-regs/arch-support.txt       |   4 +-
 .../features/perf/perf-stackdump/arch-support.txt  |   4 +-
 .../sched/membarrier-sync-core/arch-support.txt    |   2 +
 .../features/sched/numa-balancing/arch-support.txt |   6 +-
 Documentation/features/scripts/features-refresh.sh |  98 ++++
 .../seccomp/seccomp-filter/arch-support.txt        |   6 +-
 .../time/arch-tick-broadcast/arch-support.txt      |   4 +-
 .../features/time/clockevents/arch-support.txt     |   4 +-
 .../time/context-tracking/arch-support.txt         |   2 +
 .../features/time/irq-time-acct/arch-support.txt   |   4 +-
 .../time/modern-timekeeping/arch-support.txt       |   2 +
 .../features/time/virt-cpuacct/arch-support.txt    |   2 +
 .../features/vm/ELF-ASLR/arch-support.txt          |   4 +-
 .../features/vm/PG_uncached/arch-support.txt       |   2 +
 Documentation/features/vm/THP/arch-support.txt     |   2 +
 Documentation/features/vm/TLB/arch-support.txt     |   2 +
 .../features/vm/huge-vmap/arch-support.txt         |   2 +
 .../features/vm/ioremap_prot/arch-support.txt      |   2 +
 .../features/vm/numa-memblock/arch-support.txt     |   4 +-
 .../features/vm/pte_special/arch-support.txt       |   2 +
 Documentation/filesystems/proc.txt                 |   8 +-
 Documentation/filesystems/tmpfs.txt                |   5 +-
 Documentation/index.rst                            |   3 +-
 Documentation/ioctl/botching-up-ioctls.txt         |   4 +-
 Documentation/memory-barriers.txt                  |   4 +-
 Documentation/process/2.Process.rst                |  72 +--
 Documentation/process/5.Posting.rst                |  16 +-
 Documentation/process/index.rst                    |   1 +
 Documentation/process/maintainer-pgp-guide.rst     |  39 +-
 Documentation/process/submitting-patches.rst       |   2 +-
 Documentation/security/index.rst                   |   2 +
 Documentation/sound/alsa-configuration.rst         |   4 +-
 Documentation/sound/soc/codec.rst                  |   2 +-
 Documentation/sound/soc/platform.rst               |   2 +-
 Documentation/sysctl/vm.txt                        |   6 +-
 Documentation/trace/coresight.txt                  | 103 ++--
 Documentation/trace/ftrace-uses.rst                |   4 +-
 Documentation/trace/ftrace.rst                     |   7 +-
 .../translations/ko_KR/memory-barriers.txt         |   4 +-
 Documentation/vfio.txt                             |   5 +-
 Documentation/vm/00-INDEX                          |  58 +--
 Documentation/vm/active_mm.rst                     |  91 ++++
 Documentation/vm/active_mm.txt                     |  83 ----
 Documentation/vm/{balance => balance.rst}          |  15 +-
 .../vm/{cleancache.txt => cleancache.rst}          | 105 ++--
 Documentation/vm/conf.py                           |  10 +
 Documentation/vm/{frontswap.txt => frontswap.rst}  |  59 ++-
 Documentation/vm/{highmem.txt => highmem.rst}      |  87 ++--
 Documentation/vm/{hmm.txt => hmm.rst}              |  78 ++-
 .../{hugetlbfs_reserv.txt => hugetlbfs_reserv.rst} | 220 ++++++---
 Documentation/vm/{hwpoison.txt => hwpoison.rst}    | 141 +++---
 Documentation/vm/index.rst                         |  50 ++
 Documentation/vm/ksm.rst                           |  87 ++++
 Documentation/vm/ksm.txt                           | 178 -------
 Documentation/vm/mmu_notifier.rst                  |  99 ++++
 Documentation/vm/mmu_notifier.txt                  |  93 ----
 Documentation/vm/{numa => numa.rst}                |   6 +-
 Documentation/vm/numa_memory_policy.txt            | 452 ------------------
 Documentation/vm/overcommit-accounting             |  80 ----
 Documentation/vm/overcommit-accounting.rst         |  87 ++++
 Documentation/vm/{page_frags => page_frags.rst}    |   5 +-
 .../vm/{page_migration => page_migration.rst}      | 149 +++---
 .../vm/{page_owner.txt => page_owner.rst}          |  34 +-
 .../{remap_file_pages.txt => remap_file_pages.rst} |   6 +
 Documentation/vm/slub.rst                          | 361 ++++++++++++++
 Documentation/vm/slub.txt                          | 342 -------------
 ...t_page_table_lock => split_page_table_lock.rst} |  12 +-
 Documentation/vm/{swap_numa.txt => swap_numa.rst}  |  55 ++-
 Documentation/vm/transhuge.rst                     | 197 ++++++++
 Documentation/vm/transhuge.txt                     | 527 ---------------------
 .../{unevictable-lru.txt => unevictable-lru.rst}   | 117 ++---
 Documentation/vm/{z3fold.txt => z3fold.rst}        |   6 +-
 Documentation/vm/{zsmalloc.txt => zsmalloc.rst}    |  60 ++-
 Documentation/vm/{zswap.txt => zswap.rst}          |  71 +--
 LICENSES/exceptions/Linux-syscall-note             |   2 +-
 LICENSES/other/Apache-2.0                          | 183 +++++++
 LICENSES/other/CC-BY-SA-4.0                        | 397 ++++++++++++++++
 LICENSES/other/CDDL-1.0                            | 364 ++++++++++++++
 LICENSES/other/Linux-OpenIB                        |  26 +
 LICENSES/other/X11                                 |  37 ++
 LICENSES/preferred/GPL-2.0                         |   6 +
 MAINTAINERS                                        |   2 +-
 arch/alpha/Kconfig                                 |   2 +-
 arch/ia64/Kconfig                                  |   2 +-
 arch/mips/Kconfig                                  |   2 +-
 arch/powerpc/Kconfig                               |   2 +-
 drivers/w1/w1_io.c                                 |   1 +
 fs/Kconfig                                         |   2 +-
 fs/dax.c                                           |   2 +-
 fs/proc/task_mmu.c                                 |   4 +-
 include/linux/hmm.h                                |   2 +-
 include/linux/memremap.h                           |   4 +-
 include/linux/mmu_notifier.h                       |   2 +-
 include/linux/sched/mm.h                           |  42 +-
 include/linux/swap.h                               |   2 +-
 mm/Kconfig                                         |   7 +-
 mm/cleancache.c                                    |   2 +-
 mm/frontswap.c                                     |   2 +-
 mm/hmm.c                                           |   2 +-
 mm/huge_memory.c                                   |   4 +-
 mm/hugetlb.c                                       |   4 +-
 mm/ksm.c                                           |  23 +-
 mm/mmap.c                                          |   2 +-
 mm/rmap.c                                          |   6 +-
 mm/util.c                                          |   2 +-
 scripts/documentation-file-ref-check               | 125 ++++-
 scripts/spdxcheck.py                               | 284 +++++++++++
 168 files changed, 5538 insertions(+), 2921 deletions(-)
 rename Documentation/{bcache.txt => admin-guide/bcache.rst} (100%)
 rename Documentation/{cgroup-v2.txt => admin-guide/cgroup-v2.rst} (100%)
 create mode 100644 Documentation/admin-guide/mm/concepts.rst
 rename Documentation/{vm/hugetlbpage.txt => admin-guide/mm/hugetlbpage.rst} (61%)
 rename Documentation/{vm/idle_page_tracking.txt => admin-guide/mm/idle_page_tracking.rst} (72%)
 create mode 100644 Documentation/admin-guide/mm/index.rst
 create mode 100644 Documentation/admin-guide/mm/ksm.rst
 create mode 100644 Documentation/admin-guide/mm/numa_memory_policy.rst
 rename Documentation/{vm/pagemap.txt => admin-guide/mm/pagemap.rst} (53%)
 rename Documentation/{vm/soft-dirty.txt => admin-guide/mm/soft-dirty.rst} (67%)
 create mode 100644 Documentation/admin-guide/mm/transhuge.rst
 rename Documentation/{vm/userfaultfd.txt => admin-guide/mm/userfaultfd.rst} (89%)
 rename Documentation/{cachetlb.txt => core-api/cachetlb.rst} (100%)
 rename Documentation/{circular-buffers.txt => core-api/circular-buffers.rst} (100%)
 create mode 100644 Documentation/core-api/gfp_mask-from-fs-io.rst
 rename Documentation/{clk.txt => driver-api/clk.rst} (100%)
 rename Documentation/features/{lib/strncasecmp => core/cBPF-JIT}/arch-support.txt (70%)
 rename Documentation/features/core/{BPF-JIT => eBPF-JIT}/arch-support.txt (79%)
 create mode 100755 Documentation/features/scripts/features-refresh.sh
 create mode 100644 Documentation/vm/active_mm.rst
 delete mode 100644 Documentation/vm/active_mm.txt
 rename Documentation/vm/{balance => balance.rst} (96%)
 rename Documentation/vm/{cleancache.txt => cleancache.rst} (83%)
 create mode 100644 Documentation/vm/conf.py
 rename Documentation/vm/{frontswap.txt => frontswap.rst} (91%)
 rename Documentation/vm/{highmem.txt => highmem.rst} (64%)
 rename Documentation/vm/{hmm.txt => hmm.rst} (91%)
 rename Documentation/vm/{hugetlbfs_reserv.txt => hugetlbfs_reserv.rst} (86%)
 rename Documentation/vm/{hwpoison.txt => hwpoison.rst} (60%)
 create mode 100644 Documentation/vm/index.rst
 create mode 100644 Documentation/vm/ksm.rst
 delete mode 100644 Documentation/vm/ksm.txt
 create mode 100644 Documentation/vm/mmu_notifier.rst
 delete mode 100644 Documentation/vm/mmu_notifier.txt
 rename Documentation/vm/{numa => numa.rst} (98%)
 delete mode 100644 Documentation/vm/numa_memory_policy.txt
 delete mode 100644 Documentation/vm/overcommit-accounting
 create mode 100644 Documentation/vm/overcommit-accounting.rst
 rename Documentation/vm/{page_frags => page_frags.rst} (97%)
 rename Documentation/vm/{page_migration => page_migration.rst} (63%)
 rename Documentation/vm/{page_owner.txt => page_owner.rst} (86%)
 rename Documentation/vm/{remap_file_pages.txt => remap_file_pages.rst} (92%)
 create mode 100644 Documentation/vm/slub.rst
 delete mode 100644 Documentation/vm/slub.txt
 rename Documentation/vm/{split_page_table_lock => split_page_table_lock.rst} (95%)
 rename Documentation/vm/{swap_numa.txt => swap_numa.rst} (74%)
 create mode 100644 Documentation/vm/transhuge.rst
 delete mode 100644 Documentation/vm/transhuge.txt
 rename Documentation/vm/{unevictable-lru.txt => unevictable-lru.rst} (92%)
 rename Documentation/vm/{z3fold.txt => z3fold.rst} (97%)
 rename Documentation/vm/{zsmalloc.txt => zsmalloc.rst} (71%)
 rename Documentation/vm/{zswap.txt => zswap.rst} (74%)
 create mode 100644 LICENSES/other/Apache-2.0
 create mode 100644 LICENSES/other/CC-BY-SA-4.0
 create mode 100644 LICENSES/other/CDDL-1.0
 create mode 100644 LICENSES/other/Linux-OpenIB
 create mode 100644 LICENSES/other/X11
 create mode 100755 scripts/spdxcheck.py
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [v5,1/7] powerpc: Add TIDR CPU feature for POWER9
From: Michael Ellerman @ 2018-06-04 14:10 UTC (permalink / raw)
  To: Alastair D'Silva, linuxppc-dev
  Cc: mikey, arnd, linux-doc, malat, gregkh, corbet, vaibhav, npiggin,
	linux-kernel, fbarrat, aneesh.kumar, andrew.donnellan,
	pombredanne, felix, sukadev, Alastair D'Silva
In-Reply-To: <20180511061303.10728-2-alastair@au1.ibm.com>

On Fri, 2018-05-11 at 06:12:57 UTC, "Alastair D'Silva" wrote:
> From: Alastair D'Silva <alastair@d-silva.org>
> 
> This patch adds a CPU feature bit to show whether the CPU has
> the TIDR register available, enabling as_notify/wait in userspace.
> 
> Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
> Reviewed-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
> Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/819844285ef2b5d15466f5b5062514

cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH v5] Add udmabuf misc device
From: Gerd Hoffmann @ 2018-06-04 14:43 UTC (permalink / raw)
  To: dri-devel
  Cc: Gerd Hoffmann, David Airlie, Tomeu Vizoso, Daniel Vetter,
	Jonathan Corbet, Sumit Semwal, Shuah Khan,
	open list:DOCUMENTATION, open list,
	open list:DMA BUFFER SHARING FRAMEWORK,
	moderated list:DMA BUFFER SHARING FRAMEWORK,
	open list:KERNEL SELFTEST FRAMEWORK

A driver to let userspace turn memfd regions into dma-bufs.

Use case:  Allows qemu create dmabufs for the vga framebuffer or
virtio-gpu ressources.  Then they can be passed around to display
those guest things on the host.  To spice client for classic full
framebuffer display, and hopefully some day to wayland server for
seamless guest window display.

qemu test branch:
  https://git.kraxel.org/cgit/qemu/log/?h=sirius/udmabuf

Cc: David Airlie <airlied@linux.ie>
Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 Documentation/ioctl/ioctl-number.txt              |   1 +
 include/uapi/linux/udmabuf.h                      |  33 +++
 drivers/dma-buf/udmabuf.c                         | 302 ++++++++++++++++++++++
 tools/testing/selftests/drivers/dma-buf/udmabuf.c |  96 +++++++
 MAINTAINERS                                       |   8 +
 drivers/dma-buf/Kconfig                           |   8 +
 drivers/dma-buf/Makefile                          |   1 +
 tools/testing/selftests/drivers/dma-buf/Makefile  |   5 +
 8 files changed, 454 insertions(+)
 create mode 100644 include/uapi/linux/udmabuf.h
 create mode 100644 drivers/dma-buf/udmabuf.c
 create mode 100644 tools/testing/selftests/drivers/dma-buf/udmabuf.c
 create mode 100644 tools/testing/selftests/drivers/dma-buf/Makefile

diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt
index 7f7413e597..1720c9e04a 100644
--- a/Documentation/ioctl/ioctl-number.txt
+++ b/Documentation/ioctl/ioctl-number.txt
@@ -271,6 +271,7 @@ Code  Seq#(hex)	Include File		Comments
 't'	90-91	linux/toshiba.h		toshiba and toshiba_acpi SMM
 'u'	00-1F	linux/smb_fs.h		gone
 'u'	20-3F	linux/uvcvideo.h	USB video class host driver
+'u'	40-4f	linux/udmabuf.h		userspace dma-buf misc device
 'v'	00-1F	linux/ext2_fs.h		conflict!
 'v'	00-1F	linux/fs.h		conflict!
 'v'	00-0F	linux/sonypi.h		conflict!
diff --git a/include/uapi/linux/udmabuf.h b/include/uapi/linux/udmabuf.h
new file mode 100644
index 0000000000..46b6532ed8
--- /dev/null
+++ b/include/uapi/linux/udmabuf.h
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _UAPI_LINUX_UDMABUF_H
+#define _UAPI_LINUX_UDMABUF_H
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+#define UDMABUF_FLAGS_CLOEXEC	0x01
+
+struct udmabuf_create {
+	__u32 memfd;
+	__u32 flags;
+	__u64 offset;
+	__u64 size;
+};
+
+struct udmabuf_create_item {
+	__u32 memfd;
+	__u32 __pad;
+	__u64 offset;
+	__u64 size;
+};
+
+struct udmabuf_create_list {
+	__u32 flags;
+	__u32 count;
+	struct udmabuf_create_item list[];
+};
+
+#define UDMABUF_CREATE       _IOW('u', 0x42, struct udmabuf_create)
+#define UDMABUF_CREATE_LIST  _IOW('u', 0x43, struct udmabuf_create_list)
+
+#endif /* _UAPI_LINUX_UDMABUF_H */
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
new file mode 100644
index 0000000000..ae1390d2bd
--- /dev/null
+++ b/drivers/dma-buf/udmabuf.c
@@ -0,0 +1,302 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/miscdevice.h>
+#include <linux/dma-buf.h>
+#include <linux/highmem.h>
+#include <linux/cred.h>
+#include <linux/shmem_fs.h>
+
+#include <uapi/linux/udmabuf.h>
+
+struct udmabuf {
+	u32 pagecount;
+	struct page **pages;
+};
+
+static int udmabuf_vm_fault(struct vm_fault *vmf)
+{
+	struct vm_area_struct *vma = vmf->vma;
+	struct udmabuf *ubuf = vma->vm_private_data;
+
+	if (WARN_ON(vmf->pgoff >= ubuf->pagecount))
+		return VM_FAULT_SIGBUS;
+
+	vmf->page = ubuf->pages[vmf->pgoff];
+	get_page(vmf->page);
+	return 0;
+}
+
+static const struct vm_operations_struct udmabuf_vm_ops = {
+	.fault = udmabuf_vm_fault,
+};
+
+static int mmap_udmabuf(struct dma_buf *buf, struct vm_area_struct *vma)
+{
+	struct udmabuf *ubuf = buf->priv;
+
+	if ((vma->vm_flags & (VM_SHARED | VM_MAYSHARE)) == 0)
+		return -EINVAL;
+
+	vma->vm_ops = &udmabuf_vm_ops;
+	vma->vm_private_data = ubuf;
+	return 0;
+}
+
+static struct sg_table *map_udmabuf(struct dma_buf_attachment *at,
+				    enum dma_data_direction direction)
+{
+	struct udmabuf *ubuf = at->dmabuf->priv;
+	struct sg_table *sg;
+
+	sg = kzalloc(sizeof(*sg), GFP_KERNEL);
+	if (!sg)
+		goto err1;
+	if (sg_alloc_table_from_pages(sg, ubuf->pages, ubuf->pagecount,
+				      0, ubuf->pagecount << PAGE_SHIFT,
+				      GFP_KERNEL) < 0)
+		goto err2;
+	if (!dma_map_sg(at->dev, sg->sgl, sg->nents, direction))
+		goto err3;
+
+	return sg;
+
+err3:
+	sg_free_table(sg);
+err2:
+	kfree(sg);
+err1:
+	return ERR_PTR(-ENOMEM);
+}
+
+static void unmap_udmabuf(struct dma_buf_attachment *at,
+			  struct sg_table *sg,
+			  enum dma_data_direction direction)
+{
+	sg_free_table(sg);
+	kfree(sg);
+}
+
+static void release_udmabuf(struct dma_buf *buf)
+{
+	struct udmabuf *ubuf = buf->priv;
+	pgoff_t pg;
+
+	for (pg = 0; pg < ubuf->pagecount; pg++)
+		put_page(ubuf->pages[pg]);
+	kfree(ubuf->pages);
+	kfree(ubuf);
+}
+
+static void *kmap_atomic_udmabuf(struct dma_buf *buf, unsigned long page_num)
+{
+	struct udmabuf *ubuf = buf->priv;
+	struct page *page = ubuf->pages[page_num];
+
+	return kmap_atomic(page);
+}
+
+static void kunmap_atomic_udmabuf(struct dma_buf *buf, unsigned long page_num,
+				  void *vaddr)
+{
+	kunmap_atomic(vaddr);
+}
+
+static void *kmap_udmabuf(struct dma_buf *buf, unsigned long page_num)
+{
+	struct udmabuf *ubuf = buf->priv;
+	struct page *page = ubuf->pages[page_num];
+
+	return kmap(page);
+}
+
+static void kunmap_udmabuf(struct dma_buf *buf, unsigned long page_num,
+			   void *vaddr)
+{
+	kunmap(vaddr);
+}
+
+static struct dma_buf_ops udmabuf_ops = {
+	.map_dma_buf	  = map_udmabuf,
+	.unmap_dma_buf	  = unmap_udmabuf,
+	.release	  = release_udmabuf,
+	.map_atomic	  = kmap_atomic_udmabuf,
+	.unmap_atomic	  = kunmap_atomic_udmabuf,
+	.map		  = kmap_udmabuf,
+	.unmap		  = kunmap_udmabuf,
+	.mmap		  = mmap_udmabuf,
+};
+
+#define SEALS_WANTED (F_SEAL_SHRINK)
+#define SEALS_DENIED (F_SEAL_WRITE)
+
+static long udmabuf_create(struct udmabuf_create_list *head,
+			   struct udmabuf_create_item *list)
+{
+	DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
+	struct file *memfd = NULL;
+	struct udmabuf *ubuf;
+	struct dma_buf *buf;
+	pgoff_t pgoff, pgcnt, pgidx, pgbuf;
+	struct page *page;
+	int seals, ret = -EINVAL;
+	u32 i, flags;
+
+	ubuf = kzalloc(sizeof(struct udmabuf), GFP_KERNEL);
+	if (!ubuf)
+		return -ENOMEM;
+
+	for (i = 0; i < head->count; i++) {
+		if (!IS_ALIGNED(list[i].offset, PAGE_SIZE))
+			goto err_free_ubuf;
+		if (!IS_ALIGNED(list[i].size, PAGE_SIZE))
+			goto err_free_ubuf;
+		ubuf->pagecount += list[i].size >> PAGE_SHIFT;
+	}
+	ubuf->pages = kmalloc_array(ubuf->pagecount, sizeof(struct page *),
+				    GFP_KERNEL);
+	if (!ubuf->pages) {
+		ret = -ENOMEM;
+		goto err_free_ubuf;
+	}
+
+	pgbuf = 0;
+	for (i = 0; i < head->count; i++) {
+		memfd = fget(list[i].memfd);
+		if (!memfd)
+			goto err_put_pages;
+		if (!shmem_mapping(file_inode(memfd)->i_mapping))
+			goto err_put_pages;
+		seals = memfd_fcntl(memfd, F_GET_SEALS, 0);
+		if (seals == -EINVAL ||
+		    (seals & SEALS_WANTED) != SEALS_WANTED ||
+		    (seals & SEALS_DENIED) != 0)
+			goto err_put_pages;
+		pgoff = list[i].offset >> PAGE_SHIFT;
+		pgcnt = list[i].size   >> PAGE_SHIFT;
+		for (pgidx = 0; pgidx < pgcnt; pgidx++) {
+			page = shmem_read_mapping_page(
+				file_inode(memfd)->i_mapping, pgoff + pgidx);
+			if (IS_ERR(page)) {
+				ret = PTR_ERR(page);
+				goto err_put_pages;
+			}
+			ubuf->pages[pgbuf++] = page;
+		}
+		fput(memfd);
+	}
+	memfd = NULL;
+
+	exp_info.ops  = &udmabuf_ops;
+	exp_info.size = ubuf->pagecount << PAGE_SHIFT;
+	exp_info.priv = ubuf;
+
+	buf = dma_buf_export(&exp_info);
+	if (IS_ERR(buf)) {
+		ret = PTR_ERR(buf);
+		goto err_put_pages;
+	}
+
+	flags = 0;
+	if (head->flags & UDMABUF_FLAGS_CLOEXEC)
+		flags |= O_CLOEXEC;
+	return dma_buf_fd(buf, flags);
+
+err_put_pages:
+	while (pgbuf > 0)
+		put_page(ubuf->pages[--pgbuf]);
+err_free_ubuf:
+	fput(memfd);
+	kfree(ubuf->pages);
+	kfree(ubuf);
+	return ret;
+}
+
+static long udmabuf_ioctl_create(struct file *filp, unsigned long arg)
+{
+	struct udmabuf_create create;
+	struct udmabuf_create_list head;
+	struct udmabuf_create_item list;
+
+	if (copy_from_user(&create, (void __user *)arg,
+			   sizeof(struct udmabuf_create)))
+		return -EFAULT;
+
+	head.flags  = create.flags;
+	head.count  = 1;
+	list.memfd  = create.memfd;
+	list.offset = create.offset;
+	list.size   = create.size;
+
+	return udmabuf_create(&head, &list);
+}
+
+static long udmabuf_ioctl_create_list(struct file *filp, unsigned long arg)
+{
+	struct udmabuf_create_list head;
+	struct udmabuf_create_item *list;
+	int ret = -EINVAL;
+	u32 lsize;
+
+	if (copy_from_user(&head, (void __user *)arg, sizeof(head)))
+		return -EFAULT;
+	if (head.count > 1024)
+		return -EINVAL;
+	lsize = sizeof(struct udmabuf_create_item) * head.count;
+	list = memdup_user((void __user *)(arg + sizeof(head)), lsize);
+	if (IS_ERR(list))
+		return PTR_ERR(list);
+
+	ret = udmabuf_create(&head, list);
+	kfree(list);
+	return ret;
+}
+
+static long udmabuf_ioctl(struct file *filp, unsigned int ioctl,
+			  unsigned long arg)
+{
+	long ret;
+
+	switch (ioctl) {
+	case UDMABUF_CREATE:
+		ret = udmabuf_ioctl_create(filp, arg);
+		break;
+	case UDMABUF_CREATE_LIST:
+		ret = udmabuf_ioctl_create_list(filp, arg);
+		break;
+	default:
+		ret = -EINVAL;
+		break;
+	}
+	return ret;
+}
+
+static const struct file_operations udmabuf_fops = {
+	.owner		= THIS_MODULE,
+	.unlocked_ioctl = udmabuf_ioctl,
+};
+
+static struct miscdevice udmabuf_misc = {
+	.minor          = MISC_DYNAMIC_MINOR,
+	.name           = "udmabuf",
+	.fops           = &udmabuf_fops,
+};
+
+static int __init udmabuf_dev_init(void)
+{
+	return misc_register(&udmabuf_misc);
+}
+
+static void __exit udmabuf_dev_exit(void)
+{
+	misc_deregister(&udmabuf_misc);
+}
+
+module_init(udmabuf_dev_init)
+module_exit(udmabuf_dev_exit)
+
+MODULE_AUTHOR("Gerd Hoffmann <kraxel@redhat.com>");
+MODULE_LICENSE("GPL v2");
diff --git a/tools/testing/selftests/drivers/dma-buf/udmabuf.c b/tools/testing/selftests/drivers/dma-buf/udmabuf.c
new file mode 100644
index 0000000000..376b1d6730
--- /dev/null
+++ b/tools/testing/selftests/drivers/dma-buf/udmabuf.c
@@ -0,0 +1,96 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <malloc.h>
+
+#include <sys/ioctl.h>
+#include <sys/syscall.h>
+#include <linux/memfd.h>
+#include <linux/udmabuf.h>
+
+#define TEST_PREFIX	"drivers/dma-buf/udmabuf"
+#define NUM_PAGES       4
+
+static int memfd_create(const char *name, unsigned int flags)
+{
+	return syscall(__NR_memfd_create, name, flags);
+}
+
+int main(int argc, char *argv[])
+{
+	struct udmabuf_create create;
+	int devfd, memfd, buf, ret;
+	off_t size;
+	void *mem;
+
+	devfd = open("/dev/udmabuf", O_RDWR);
+	if (devfd < 0) {
+		printf("%s: [skip,no-udmabuf]\n", TEST_PREFIX);
+		exit(77);
+	}
+
+	memfd = memfd_create("udmabuf-test", MFD_CLOEXEC);
+	if (memfd < 0) {
+		printf("%s: [skip,no-memfd]\n", TEST_PREFIX);
+		exit(77);
+	}
+
+	size = getpagesize() * NUM_PAGES;
+	ret = ftruncate(memfd, size);
+	if (ret == -1) {
+		printf("%s: [FAIL,memfd-truncate]\n", TEST_PREFIX);
+		exit(1);
+	}
+
+	memset(&create, 0, sizeof(create));
+
+	/* should fail (offset not page aligned) */
+	create.memfd  = memfd;
+	create.offset = getpagesize()/2;
+	create.size   = getpagesize();
+	buf = ioctl(devfd, UDMABUF_CREATE, &create);
+	if (buf >= 0) {
+		printf("%s: [FAIL,test-1]\n", TEST_PREFIX);
+		exit(1);
+	}
+
+	/* should fail (size not multiple of page) */
+	create.memfd  = memfd;
+	create.offset = 0;
+	create.size   = getpagesize()/2;
+	buf = ioctl(devfd, UDMABUF_CREATE, &create);
+	if (buf >= 0) {
+		printf("%s: [FAIL,test-2]\n", TEST_PREFIX);
+		exit(1);
+	}
+
+	/* should fail (not memfd) */
+	create.memfd  = 0; /* stdin */
+	create.offset = 0;
+	create.size   = size;
+	buf = ioctl(devfd, UDMABUF_CREATE, &create);
+	if (buf >= 0) {
+		printf("%s: [FAIL,test-3]\n", TEST_PREFIX);
+		exit(1);
+	}
+
+	/* should work */
+	create.memfd  = memfd;
+	create.offset = 0;
+	create.size   = size;
+	buf = ioctl(devfd, UDMABUF_CREATE, &create);
+	if (buf < 0) {
+		printf("%s: [FAIL,test-4]\n", TEST_PREFIX);
+		exit(1);
+	}
+
+	fprintf(stderr, "%s: ok\n", TEST_PREFIX);
+	close(buf);
+	close(memfd);
+	close(devfd);
+	return 0;
+}
diff --git a/MAINTAINERS b/MAINTAINERS
index 9c125f705f..aa91159afd 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14426,6 +14426,14 @@ S:	Maintained
 F:	Documentation/filesystems/udf.txt
 F:	fs/udf/
 
+UDMABUF DRIVER
+M:	Gerd Hoffmann <kraxel@redhat.com>
+L:	dri-devel@lists.freedesktop.org
+S:	Maintained
+F:	drivers/dma-buf/udmabuf.c
+F:	include/uapi/linux/udmabuf.h
+F:	tools/testing/selftests/drivers/dma-buf/udmabuf.c
+
 UDRAW TABLET
 M:	Bastien Nocera <hadess@hadess.net>
 L:	linux-input@vger.kernel.org
diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig
index ed3b785bae..338129eb12 100644
--- a/drivers/dma-buf/Kconfig
+++ b/drivers/dma-buf/Kconfig
@@ -30,4 +30,12 @@ config SW_SYNC
 	  WARNING: improper use of this can result in deadlocking kernel
 	  drivers from userspace. Intended for test and debug only.
 
+config UDMABUF
+	bool "userspace dmabuf misc driver"
+	default n
+	depends on DMA_SHARED_BUFFER
+	help
+	  A driver to let userspace turn memfd regions into dma-bufs.
+	  Qemu can use this to create host dmabufs for guest framebuffers.
+
 endmenu
diff --git a/drivers/dma-buf/Makefile b/drivers/dma-buf/Makefile
index c33bf88631..0913a6ccab 100644
--- a/drivers/dma-buf/Makefile
+++ b/drivers/dma-buf/Makefile
@@ -1,3 +1,4 @@
 obj-y := dma-buf.o dma-fence.o dma-fence-array.o reservation.o seqno-fence.o
 obj-$(CONFIG_SYNC_FILE)		+= sync_file.o
 obj-$(CONFIG_SW_SYNC)		+= sw_sync.o sync_debug.o
+obj-$(CONFIG_UDMABUF)		+= udmabuf.o
diff --git a/tools/testing/selftests/drivers/dma-buf/Makefile b/tools/testing/selftests/drivers/dma-buf/Makefile
new file mode 100644
index 0000000000..4154c3d7aa
--- /dev/null
+++ b/tools/testing/selftests/drivers/dma-buf/Makefile
@@ -0,0 +1,5 @@
+CFLAGS += -I../../../../../usr/include/
+
+TEST_GEN_PROGS := udmabuf
+
+include ../../lib.mk
-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* RE: [PATCH v2 3/7] PCI: cadence: Update cdns_pcie_ep_raise_irq function signature
From: Alan Douglas @ 2018-06-04 15:08 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Gustavo Pimentel, bhelgaas@google.com,
	lorenzo.pieralisi@arm.com, Joao.Pinto@synopsys.com,
	jingoohan1@gmail.com, jesper.nilsson@axis.com
  Cc: linux-pci@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
In-Reply-To: <aa86d9b7-d715-2a21-6a94-be927e55b51b@ti.com>

On 31 May 2018 11:51, Kishon Vijay Abraham I  wrote:
> Hi Alan,
> 
> On Thursday 17 May 2018 10:39 PM, Gustavo Pimentel wrote:
> > Change cdns_pcie_ep_raise_irq() signature, namely the interrupt_num
> > variable type from u8 to u16 to accommodate 2048 maximum MSI-X
> > interrupts.
> >
> > Signed-off-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
> > Acked-by: Alan Douglas <adouglas@cadence.com>
> 
> Do you want to add MSI-X support to cadence PCIe?
> 
I do want to add MSI-X support, in fact I have done some tests with a
modified cadence driver with this set, so plan to submit a patch later.

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH] doc: update description of ceph mount option
From: Ilya Dryomov @ 2018-06-04 15:38 UTC (permalink / raw)
  To: Chengguang Xu; +Cc: Ceph Development, linux-doc, Yan, Zheng, Jonathan Corbet
In-Reply-To: <20180604121005.24471-1-cgxu519@gmx.com>

On Mon, Jun 4, 2018 at 2:10 PM, Chengguang Xu <cgxu519@gmx.com> wrote:
> Based on code, default value of rsize/wsize is 16 MB.
>
> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
> ---
>  Documentation/filesystems/ceph.txt | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/filesystems/ceph.txt b/Documentation/filesystems/ceph.txt
> index d7f011ddc150..8bf62240e10d 100644
> --- a/Documentation/filesystems/ceph.txt
> +++ b/Documentation/filesystems/ceph.txt
> @@ -105,15 +105,13 @@ Mount Options
>         address its connection to the monitor originates from.
>
>    wsize=X
> -       Specify the maximum write size in bytes.  By default there is no
> -       maximum.  Ceph will normally size writes based on the file stripe
> -       size.
> +       Specify the maximum write size in bytes.  Default: 16 MB.
>
>    rsize=X
> -       Specify the maximum read size in bytes.  Default: 64 MB.
> +       Specify the maximum read size in bytes.  Default: 16 MB.
>
>    rasize=X
> -       Specify the maximum readahead.  Default: 8 MB.
> +       Specify the maximum readahead size in bytes.  Default: 8 MB.
>
>    mount_timeout=X
>         Specify the timeout value for mount (in seconds), in the case

Applied.

Thanks,

                Ilya
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [RFC PATCH -tip v5 01/27] Documentation/kprobes: Fix to remove remaining jprobe
From: Masami Hiramatsu @ 2018-06-04 15:49 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar
  Cc: Masami Hiramatsu, Ingo Molnar, H . Peter Anvin, linux-kernel,
	Ananth N Mavinakayanahalli, Andrew Morton, Steven Rostedt,
	linux-arch, Jonathan Corbet, linux-doc
In-Reply-To: <152812730943.10068.5166429445118734697.stgit@devbox>

Remove jps from the document, since jprobe is removed.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org
---
 Documentation/kprobes.txt |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt
index 22208bf2386d..5ae80baf3921 100644
--- a/Documentation/kprobes.txt
+++ b/Documentation/kprobes.txt
@@ -474,7 +474,7 @@ error occurs during registration, all probes in the array, up to
 the bad probe, are safely unregistered before the register_*probes
 function returns.
 
-- kps/rps/jps: an array of pointers to ``*probe`` data structures
+- kps/rps: an array of pointers to ``*probe`` data structures
 - num: the number of the array entries.
 
 .. note::

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* Re: [PATCH] docs/admin-guide/mm: add high level concepts overview
From: Randy Dunlap @ 2018-06-04 15:53 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: Jonathan Corbet, linux-doc, linux-mm, linux-kernel
In-Reply-To: <20180604122235.GB15196@rapoport-lnx>

On 06/04/2018 05:22 AM, Mike Rapoport wrote:
> Hi Randy,
> 
> Thanks for the review! I always have trouble with articles :)
> The patch below addresses most of your comments.
> 
> On Fri, Jun 01, 2018 at 05:09:38PM -0700, Randy Dunlap wrote:
>> On 05/29/2018 04:37 AM, Mike Rapoport wrote:
>>> Hi,
>>>
>>> From 2d3ec7ea101a66b1535d5bec4acfc1e0f737fd53 Mon Sep 17 00:00:00 2001
>>> From: Mike Rapoport <rppt@linux.vnet.ibm.com>
>>> Date: Tue, 29 May 2018 14:12:39 +0300
>>> Subject: [PATCH] docs/admin-guide/mm: add high level concepts overview
>>>
>>> The are terms that seem obvious to the mm developers, but may be somewhat
> 
> Huh, I afraid it's to late to change the commit message :(

Sure.

>>   There are [or: These are]
>>
>>> obscure for, say, less involved readers.
>>>
>>> The concepts overview can be seen as an "extended glossary" that introduces
>>> such terms to the readers of the kernel documentation.
>>>
>>> Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
>>> ---
>>>  Documentation/admin-guide/mm/concepts.rst | 222 ++++++++++++++++++++++++++++++
>>>  Documentation/admin-guide/mm/index.rst    |   5 +
>>>  2 files changed, 227 insertions(+)
>>>  create mode 100644 Documentation/admin-guide/mm/concepts.rst
>>>
>>> diff --git a/Documentation/admin-guide/mm/concepts.rst b/Documentation/admin-guide/mm/concepts.rst
>>> new file mode 100644
>>> index 0000000..291699c
>>> --- /dev/null
>>> +++ b/Documentation/admin-guide/mm/concepts.rst
> 
> [...]
> 
>>> +All this makes dealing directly with physical memory quite complex and
>>> +to avoid this complexity a concept of virtual memory was developed.
>>> +
>>> +The virtual memory abstracts the details of physical memory from the
>>
>>        virtual memory {system, implementation} abstracts
>>
>>> +application software, allows to keep only needed information in the
>>
>>                software, allowing the VM to keep only needed information in the
>>
>>> +physical memory (demand paging) and provides a mechanism for the
>>> +protection and controlled sharing of data between processes.
>>> +
> 
> My intention was "virtual memory concept allows ... and provides ..."
> I didn't want to repeat "concept", to I've just omitted it.
> 
> Somehow, I don't feel that "system" or "implementation" fit here...

OK.  Thanks for the update.

> Subject: [PATCH] docs/admin-guide/mm/concepts.rst: grammar fixups

> The patch is mostly about adding 'a' and 'the' and updating indentation.

I would say that it's mostly about improving readability.

Acked-by: Randy Dunlap <rdunlap@infradead.org>


-- 
~Randy
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [RFC PATCH -tip v5 25/27] kprobes/x86: Do not disable preempt on int3 path
From: Masami Hiramatsu @ 2018-06-04 16:00 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar
  Cc: Masami Hiramatsu, Ingo Molnar, H . Peter Anvin, linux-kernel,
	Ananth N Mavinakayanahalli, Andrew Morton, Steven Rostedt,
	linux-arch, x86, linux-doc
In-Reply-To: <152812730943.10068.5166429445118734697.stgit@devbox>

Since int3 and debug exception(for singlestep) are run with
IRQ disabled and while running single stepping we drop IF
from regs->flags, that path must not be preemptible. So we
can remove the preempt disable/enable calls from that path.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Suggested-by: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: linux-doc@vger.kernel.org
---
 Changes in v3:
  - Split user-side changes to another patch
 Changes in v2:
  - Include user-side changes.
---
 Documentation/kprobes.txt      |   11 +++++------
 arch/x86/kernel/kprobes/core.c |   18 ++++--------------
 arch/x86/kernel/kprobes/opt.c  |    1 -
 3 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt
index 907a3017c0f2..3e9e99ea751b 100644
--- a/Documentation/kprobes.txt
+++ b/Documentation/kprobes.txt
@@ -566,12 +566,11 @@ the same handler) may run concurrently on different CPUs.
 Kprobes does not use mutexes or allocate memory except during
 registration and unregistration.
 
-Probe handlers are run with preemption disabled.  Depending on the
-architecture and optimization state, handlers may also run with
-interrupts disabled (e.g., kretprobe handlers and optimized kprobe
-handlers run without interrupt disabled on x86/x86-64).  In any case,
-your handler should not yield the CPU (e.g., by attempting to acquire
-a semaphore).
+Probe handlers are run with preemption disabled or interrupt disabled,
+which depends on the architecture and optimization state.  (e.g.,
+kretprobe handlers and optimized kprobe handlers run without interrupt
+disabled on x86/x86-64).  In any case, your handler should not yield
+the CPU (e.g., by attempting to acquire a semaphore, or waiting I/O).
 
 Since a return probe is implemented by replacing the return
 address with the trampoline's address, stack backtraces and calls
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index 814e26b7c8a2..f7104b256de7 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -594,7 +594,6 @@ static void setup_singlestep(struct kprobe *p, struct pt_regs *regs,
 		 * stepping.
 		 */
 		regs->ip = (unsigned long)p->ainsn.insn;
-		preempt_enable_no_resched();
 		return;
 	}
 #endif
@@ -667,12 +666,10 @@ int kprobe_int3_handler(struct pt_regs *regs)
 
 	addr = (kprobe_opcode_t *)(regs->ip - sizeof(kprobe_opcode_t));
 	/*
-	 * We don't want to be preempted for the entire
-	 * duration of kprobe processing. We conditionally
-	 * re-enable preemption at the end of this function,
-	 * and also in reenter_kprobe() and setup_singlestep().
+	 * We don't want to be preempted for the entire duration of kprobe
+	 * processing. Since int3 and debug trap disables irqs and we clear
+	 * IF while singlestepping, it must be no preemptible.
 	 */
-	preempt_disable();
 
 	kcb = get_kprobe_ctlblk();
 	p = get_kprobe(addr);
@@ -694,10 +691,8 @@ int kprobe_int3_handler(struct pt_regs *regs)
 			 */
 			if (!p->pre_handler || !p->pre_handler(p, regs))
 				setup_singlestep(p, regs, kcb, 0);
-			else {
+			else
 				reset_current_kprobe();
-				preempt_enable_no_resched();
-			}
 			return 1;
 		}
 	} else if (*addr != BREAKPOINT_INSTRUCTION) {
@@ -711,11 +706,9 @@ int kprobe_int3_handler(struct pt_regs *regs)
 		 * the original instruction.
 		 */
 		regs->ip = (unsigned long)addr;
-		preempt_enable_no_resched();
 		return 1;
 	} /* else: not a kprobe fault; let the kernel handle it */
 
-	preempt_enable_no_resched();
 	return 0;
 }
 NOKPROBE_SYMBOL(kprobe_int3_handler);
@@ -966,8 +959,6 @@ int kprobe_debug_handler(struct pt_regs *regs)
 	}
 	reset_current_kprobe();
 out:
-	preempt_enable_no_resched();
-
 	/*
 	 * if somebody else is singlestepping across a probe point, flags
 	 * will have TF set, in which case, continue the remaining processing
@@ -1014,7 +1005,6 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
 			restore_previous_kprobe(kcb);
 		else
 			reset_current_kprobe();
-		preempt_enable_no_resched();
 	} else if (kcb->kprobe_status == KPROBE_HIT_ACTIVE ||
 		   kcb->kprobe_status == KPROBE_HIT_SSDONE) {
 		/*
diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c
index 203d398802a3..eaf02f2e7300 100644
--- a/arch/x86/kernel/kprobes/opt.c
+++ b/arch/x86/kernel/kprobes/opt.c
@@ -491,7 +491,6 @@ int setup_detour_execution(struct kprobe *p, struct pt_regs *regs, int reenter)
 		regs->ip = (unsigned long)op->optinsn.insn + TMPL_END_IDX;
 		if (!reenter)
 			reset_current_kprobe();
-		preempt_enable_no_resched();
 		return 1;
 	}
 	return 0;

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [RFC PATCH -tip v5 26/27] Documentation: kprobes: Add how to change the execution path
From: Masami Hiramatsu @ 2018-06-04 16:01 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar
  Cc: Masami Hiramatsu, Ingo Molnar, H . Peter Anvin, linux-kernel,
	Ananth N Mavinakayanahalli, Andrew Morton, Steven Rostedt,
	linux-arch, Jonathan Corbet, linux-doc
In-Reply-To: <152812730943.10068.5166429445118734697.stgit@devbox>

Add a section that explaining how to change the execution
path with kprobes and warnings for some arch.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org
---
 Documentation/kprobes.txt |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt
index 3e9e99ea751b..8a98eed1521b 100644
--- a/Documentation/kprobes.txt
+++ b/Documentation/kprobes.txt
@@ -80,6 +80,26 @@ After the instruction is single-stepped, Kprobes executes the
 "post_handler," if any, that is associated with the kprobe.
 Execution then continues with the instruction following the probepoint.
 
+Changing Execution Path
+-----------------------
+
+Since the kprobes can probe into a running kernel code, it can change
+the register set, including instruction pointer. This operation
+requires maximum attention, such as keeping the stack frame, recovering
+execution path etc. Since it is operated on running kernel and need deep
+knowladge of the archtecture and concurrent computing, you can easily
+shot your foot.
+
+If you change the instruction pointer (and set up other related
+registers) in pre_handler, you must return !0 so that the kprobes
+stops single stepping and just returns to given address.
+This also means post_handler should not be called anymore.
+
+Note that this operation may be harder on some architectures which
+use TOC (Table of Contents) for function call, since you have to
+setup new TOC for your function in your module, and recover old
+one after back from it.
+
 Return Probes
 -------------
 

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* Re: [RFC PATCH 0/6] net: ethernet: ti: cpsw: add MQPRIO and CBS Qdisc offload
From: Vinicius Costa Gomes @ 2018-06-04 17:23 UTC (permalink / raw)
  To: Ivan Khoronzhuk, grygorii.strashko, davem
  Cc: corbet, akpm, netdev, linux-doc, linux-kernel, linux-omap, henrik,
	jesus.sanchez-palencia, Ivan Khoronzhuk
In-Reply-To: <20180518211510.13341-1-ivan.khoronzhuk@linaro.org>

Hi Ivan,

Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> writes:

> This series adds MQPRIO and CBS Qdisc offload for TI cpsw driver.
> It potentially can be used in audio video bridging (AVB) and time
> sensitive networking (TSN).
>
> Patchset was tested on AM572x EVM and BBB boards. Last patch from this
> series adds detailed description of configuration with examples. For
> consistency reasons, in role of talker and listener, tools from
> patchset "TSN: Add qdisc based config interface for CBS" were used and
> can be seen here: https://www.spinics.net/lists/netdev/msg460869.html
>
> Based on net-next/master
>

I didn't test this, but it looks fine from my side.

I agree with Grygorii, that if no comments, this should be re-sent as a
patch series next.


> Ivan Khoronzhuk (6):
>   net: ethernet: ti: cpsw: use cpdma channels in backward order for txq
>   net: ethernet: ti: cpdma: fit rated channels in backward order
>   net: ethernet: ti: cpsw: add MQPRIO Qdisc offload
>   net: ethernet: ti: cpsw: add CBS Qdisc offload
>   net: ethernet: ti: cpsw: restore shaper configuration while down/up
>   Documentation: networking: cpsw: add MQPRIO & CBS offload examples
>
>  Documentation/networking/cpsw.txt       | 540 ++++++++++++++++++++++++
>  drivers/net/ethernet/ti/cpsw.c          | 364 +++++++++++++++-
>  drivers/net/ethernet/ti/davinci_cpdma.c |  31 +-
>  3 files changed, 913 insertions(+), 22 deletions(-)
>  create mode 100644 Documentation/networking/cpsw.txt
>
> -- 
> 2.17.0


Cheers,
--
Vinicius
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v1 2/2] arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS
From: kbuild test robot @ 2018-06-04 19:06 UTC (permalink / raw)
  To: Dongjiu Geng
  Cc: kbuild-all, rkrcmar, corbet, christoffer.dall, marc.zyngier,
	linux, catalin.marinas, will.deacon, kvm, linux-doc, james.morse,
	gengdongjiu, linux-arm-kernel, linux-kernel, linux-acpi
In-Reply-To: <1527772139-19665-3-git-send-email-gengdongjiu@huawei.com>

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

Hi Dongjiu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on arm64/for-next/core]
[also build test WARNING on v4.17 next-20180601]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Dongjiu-Geng/arm64-KVM-export-the-capability-to-set-guest-SError-syndrome/20180602-175846
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: arm-axm55xx_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All warnings (new ones prefixed by >>):

   In file included from include/linux/kvm_host.h:37:0,
                    from arch/arm/kernel/asm-offsets.c:18:
>> arch/arm/include/asm/kvm_host.h:217:11: warning: 'struct kvm_vcpu_events' declared inside parameter list will not be visible outside of this definition or declaration
       struct kvm_vcpu_events *events);
              ^~~~~~~~~~~~~~~
   arch/arm/include/asm/kvm_host.h:220:11: warning: 'struct kvm_vcpu_events' declared inside parameter list will not be visible outside of this definition or declaration
       struct kvm_vcpu_events *events);
              ^~~~~~~~~~~~~~~

vim +217 arch/arm/include/asm/kvm_host.h

   210	
   211	int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init);
   212	unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu);
   213	int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices);
   214	int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
   215	int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
   216	int kvm_arm_vcpu_get_events(struct kvm_vcpu *vcpu,
 > 217				struct kvm_vcpu_events *events);
   218	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 19855 bytes --]

^ permalink raw reply

* Re: [PATCH v1 2/2] arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS
From: kbuild test robot @ 2018-06-04 20:03 UTC (permalink / raw)
  To: Dongjiu Geng
  Cc: kbuild-all, rkrcmar, corbet, christoffer.dall, marc.zyngier,
	linux, catalin.marinas, will.deacon, kvm, linux-doc, james.morse,
	gengdongjiu, linux-arm-kernel, linux-kernel, linux-acpi
In-Reply-To: <1527772139-19665-3-git-send-email-gengdongjiu@huawei.com>

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

Hi Dongjiu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on v4.17 next-20180601]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Dongjiu-Geng/arm64-KVM-export-the-capability-to-set-guest-SError-syndrome/20180602-175846
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: arm-axm55xx_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/kvm_host.h:37:0,
                    from arch/arm/kvm/guest.c:21:
   arch/arm/include/asm/kvm_host.h:217:11: warning: 'struct kvm_vcpu_events' declared inside parameter list will not be visible outside of this definition or declaration
       struct kvm_vcpu_events *events);
              ^~~~~~~~~~~~~~~
   arch/arm/include/asm/kvm_host.h:220:11: warning: 'struct kvm_vcpu_events' declared inside parameter list will not be visible outside of this definition or declaration
       struct kvm_vcpu_events *events);
              ^~~~~~~~~~~~~~~
>> arch/arm/kvm/guest.c:265:11: warning: 'struct kvm_vcpu_events' declared inside parameter list will not be visible outside of this definition or declaration
       struct kvm_vcpu_events *events)
              ^~~~~~~~~~~~~~~
>> arch/arm/kvm/guest.c:264:5: error: conflicting types for 'kvm_arm_vcpu_get_events'
    int kvm_arm_vcpu_get_events(struct kvm_vcpu *vcpu,
        ^~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/kvm_host.h:37:0,
                    from arch/arm/kvm/guest.c:21:
   arch/arm/include/asm/kvm_host.h:216:5: note: previous declaration of 'kvm_arm_vcpu_get_events' was here
    int kvm_arm_vcpu_get_events(struct kvm_vcpu *vcpu,
        ^~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/kvm/guest.c:271:11: warning: 'struct kvm_vcpu_events' declared inside parameter list will not be visible outside of this definition or declaration
       struct kvm_vcpu_events *events)
              ^~~~~~~~~~~~~~~
>> arch/arm/kvm/guest.c:270:5: error: conflicting types for 'kvm_arm_vcpu_set_events'
    int kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu,
        ^~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/kvm_host.h:37:0,
                    from arch/arm/kvm/guest.c:21:
   arch/arm/include/asm/kvm_host.h:219:5: note: previous declaration of 'kvm_arm_vcpu_set_events' was here
    int kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu,
        ^~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/kvm_host.h:37:0,
                    from arch/arm/kvm/../../../virt/kvm/arm/arm.c:22:
   arch/arm/include/asm/kvm_host.h:217:11: warning: 'struct kvm_vcpu_events' declared inside parameter list will not be visible outside of this definition or declaration
       struct kvm_vcpu_events *events);
              ^~~~~~~~~~~~~~~
   arch/arm/include/asm/kvm_host.h:220:11: warning: 'struct kvm_vcpu_events' declared inside parameter list will not be visible outside of this definition or declaration
       struct kvm_vcpu_events *events);
              ^~~~~~~~~~~~~~~
   In file included from include/asm-generic/ioctl.h:5:0,
                    from ./arch/arm/include/generated/uapi/asm/ioctl.h:1,
                    from include/uapi/linux/ioctl.h:5,
                    from include/uapi/linux/fs.h:14,
                    from include/linux/fs.h:41,
                    from include/linux/huge_mm.h:7,
                    from include/linux/mm.h:472,
                    from include/linux/kvm_host.h:17,
                    from arch/arm/kvm/../../../virt/kvm/arm/arm.c:22:
   arch/arm/kvm/../../../virt/kvm/arm/arm.c: In function 'kvm_arch_vcpu_ioctl':
>> include/uapi/linux/kvm.h:1339:54: error: invalid application of 'sizeof' to incomplete type 'struct kvm_vcpu_events'
    #define KVM_GET_VCPU_EVENTS       _IOR(KVMIO,  0x9f, struct kvm_vcpu_events)
                                                         ^
   include/uapi/asm-generic/ioctl.h:73:5: note: in definition of macro '_IOC'
      ((size) << _IOC_SIZESHIFT))
        ^~~~
>> include/uapi/asm-generic/ioctl.h:86:56: note: in expansion of macro '_IOC_TYPECHECK'
    #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
                                                           ^~~~~~~~~~~~~~
>> include/uapi/linux/kvm.h:1339:35: note: in expansion of macro '_IOR'
    #define KVM_GET_VCPU_EVENTS       _IOR(KVMIO,  0x9f, struct kvm_vcpu_events)
                                      ^~~~
>> arch/arm/kvm/../../../virt/kvm/arm/arm.c:1110:7: note: in expansion of macro 'KVM_GET_VCPU_EVENTS'
     case KVM_GET_VCPU_EVENTS: {
          ^~~~~~~~~~~~~~~~~~~
>> include/asm-generic/ioctl.h:13:25: error: array type has incomplete element type 'struct kvm_vcpu_events'
     ((sizeof(t) == sizeof(t[1]) && \
                            ^
   include/uapi/asm-generic/ioctl.h:73:5: note: in definition of macro '_IOC'
      ((size) << _IOC_SIZESHIFT))
        ^~~~
>> include/uapi/asm-generic/ioctl.h:86:56: note: in expansion of macro '_IOC_TYPECHECK'
    #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
                                                           ^~~~~~~~~~~~~~
>> include/uapi/linux/kvm.h:1339:35: note: in expansion of macro '_IOR'
    #define KVM_GET_VCPU_EVENTS       _IOR(KVMIO,  0x9f, struct kvm_vcpu_events)
                                      ^~~~
>> arch/arm/kvm/../../../virt/kvm/arm/arm.c:1110:7: note: in expansion of macro 'KVM_GET_VCPU_EVENTS'
     case KVM_GET_VCPU_EVENTS: {
          ^~~~~~~~~~~~~~~~~~~
>> include/uapi/linux/kvm.h:1339:54: error: invalid application of 'sizeof' to incomplete type 'struct kvm_vcpu_events'
    #define KVM_GET_VCPU_EVENTS       _IOR(KVMIO,  0x9f, struct kvm_vcpu_events)
                                                         ^
   include/uapi/asm-generic/ioctl.h:73:5: note: in definition of macro '_IOC'
      ((size) << _IOC_SIZESHIFT))
        ^~~~
>> include/uapi/asm-generic/ioctl.h:86:56: note: in expansion of macro '_IOC_TYPECHECK'
    #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
                                                           ^~~~~~~~~~~~~~
>> include/uapi/linux/kvm.h:1339:35: note: in expansion of macro '_IOR'
    #define KVM_GET_VCPU_EVENTS       _IOR(KVMIO,  0x9f, struct kvm_vcpu_events)
                                      ^~~~
>> arch/arm/kvm/../../../virt/kvm/arm/arm.c:1110:7: note: in expansion of macro 'KVM_GET_VCPU_EVENTS'
     case KVM_GET_VCPU_EVENTS: {
          ^~~~~~~~~~~~~~~~~~~
>> include/uapi/linux/kvm.h:1339:54: error: invalid application of 'sizeof' to incomplete type 'struct kvm_vcpu_events'
    #define KVM_GET_VCPU_EVENTS       _IOR(KVMIO,  0x9f, struct kvm_vcpu_events)
                                                         ^
   include/uapi/asm-generic/ioctl.h:73:5: note: in definition of macro '_IOC'
      ((size) << _IOC_SIZESHIFT))
        ^~~~
>> include/uapi/asm-generic/ioctl.h:86:56: note: in expansion of macro '_IOC_TYPECHECK'
    #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
                                                           ^~~~~~~~~~~~~~
>> include/uapi/linux/kvm.h:1339:35: note: in expansion of macro '_IOR'
    #define KVM_GET_VCPU_EVENTS       _IOR(KVMIO,  0x9f, struct kvm_vcpu_events)
                                      ^~~~
>> arch/arm/kvm/../../../virt/kvm/arm/arm.c:1110:7: note: in expansion of macro 'KVM_GET_VCPU_EVENTS'
     case KVM_GET_VCPU_EVENTS: {
          ^~~~~~~~~~~~~~~~~~~
>> arch/arm/kvm/../../../virt/kvm/arm/arm.c:1111:26: error: storage size of 'events' isn't known
      struct kvm_vcpu_events events;
                             ^~~~~~
   arch/arm/kvm/../../../virt/kvm/arm/arm.c:1111:26: warning: unused variable 'events' [-Wunused-variable]
   In file included from include/asm-generic/ioctl.h:5:0,
                    from ./arch/arm/include/generated/uapi/asm/ioctl.h:1,
                    from include/uapi/linux/ioctl.h:5,
                    from include/uapi/linux/fs.h:14,
                    from include/linux/fs.h:41,
                    from include/linux/huge_mm.h:7,
                    from include/linux/mm.h:472,
                    from include/linux/kvm_host.h:17,
                    from arch/arm/kvm/../../../virt/kvm/arm/arm.c:22:
   include/uapi/linux/kvm.h:1340:54: error: invalid application of 'sizeof' to incomplete type 'struct kvm_vcpu_events'
    #define KVM_SET_VCPU_EVENTS       _IOW(KVMIO,  0xa0, struct kvm_vcpu_events)
                                                         ^
   include/uapi/asm-generic/ioctl.h:73:5: note: in definition of macro '_IOC'
      ((size) << _IOC_SIZESHIFT))
        ^~~~
   include/uapi/asm-generic/ioctl.h:87:57: note: in expansion of macro '_IOC_TYPECHECK'
    #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
                                                            ^~~~~~~~~~~~~~
>> include/uapi/linux/kvm.h:1340:35: note: in expansion of macro '_IOW'
    #define KVM_SET_VCPU_EVENTS       _IOW(KVMIO,  0xa0, struct kvm_vcpu_events)
                                      ^~~~
>> arch/arm/kvm/../../../virt/kvm/arm/arm.c:1122:7: note: in expansion of macro 'KVM_SET_VCPU_EVENTS'
     case KVM_SET_VCPU_EVENTS: {
          ^~~~~~~~~~~~~~~~~~~
>> include/asm-generic/ioctl.h:13:25: error: array type has incomplete element type 'struct kvm_vcpu_events'
     ((sizeof(t) == sizeof(t[1]) && \
                            ^
   include/uapi/asm-generic/ioctl.h:73:5: note: in definition of macro '_IOC'
      ((size) << _IOC_SIZESHIFT))
        ^~~~
   include/uapi/asm-generic/ioctl.h:87:57: note: in expansion of macro '_IOC_TYPECHECK'
    #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
                                                            ^~~~~~~~~~~~~~

vim +/kvm_arm_vcpu_get_events +264 arch/arm/kvm/guest.c

   263	
 > 264	int kvm_arm_vcpu_get_events(struct kvm_vcpu *vcpu,
 > 265				struct kvm_vcpu_events *events)
   266	{
   267		return -EINVAL;
   268	}
   269	
 > 270	int kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu,
   271				struct kvm_vcpu_events *events)
   272	{
   273		return -EINVAL;
   274	}
   275	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 19855 bytes --]

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox