Re: [PATCH v2] ndctl, filter: refacor util__filter() to support multiple space-seperated arguments
On Tue, Apr 24, 2018 at 7:39 PM, Qi, Fuli wrote: > When I ran the command # ndctl list --dimm="all nmem1 nmem2", I found > only "nmem1" and "nmem2" can be listed, the keyword "all" was ignored. > I want to confirm is this result expected? > If not, I will make a follow up patch to fix this bug. Yes, good catch, that's a bug. ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
[PATCH] ndctl, filter: fix "keyword 'all' is ignored" in util__filter()
This is a follow up patch for commit c70adc3cf6bf ("ndctl, filter: refactor util__filter() to support multiple space-seperated arguments") refactored util__filter() to support multiple space-seperated arguments. But, when the keyword "all" is included in space-seperated arguments, it will be treaded as 's name. This patch fixes it. Signed-off-by: QI Fuli --- util/filter.c | 12 1 file changed, 12 insertions(+) diff --git a/util/filter.c b/util/filter.c index 0d3cc02..9081a6d 100644 --- a/util/filter.c +++ b/util/filter.c @@ -40,6 +40,9 @@ struct ndctl_bus *util_bus_filter(struct ndctl_bus *bus, const char *__ident) for (name = strtok_r(ident, " ", &save); name; name = strtok_r(NULL, " ", &save)) { + if (strcmp(ident, "all") == 0) + break; + bus_id = strtoul(ident, &end, 0); if (end == ident || end[0]) bus_id = ULONG_MAX; @@ -78,6 +81,9 @@ struct ndctl_region *util_region_filter(struct ndctl_region *region, for (name = strtok_r(ident, " ", &save); name; name = strtok_r(NULL, " ", &save)) { + if (strcmp(ident, "all") == 0) + break; + region_id = strtoul(ident, &end, 0); if (end == ident || end[0]) region_id = ULONG_MAX; @@ -115,6 +121,9 @@ struct ndctl_namespace *util_namespace_filter(struct ndctl_namespace *ndns, for (name = strtok_r(ident, " ", &save); name; name = strtok_r(NULL, " ", &save)) { + if (strcmp(ident, "all") == 0) + break; + if (strcmp(name, ndctl_namespace_get_devname(ndns)) == 0) break; @@ -146,6 +155,9 @@ struct ndctl_dimm *util_dimm_filter(struct ndctl_dimm *dimm, for (name = strtok_r(ident, " ", &save); name; name = strtok_r(NULL, " ", &save)) { + if (strcmp(ident, "all") == 0) + break; + dimm_id = strtoul(ident, &end, 0); if (end == ident || end[0]) dimm_id = ULONG_MAX; -- 2.17.0.140.g0b0cc9f86 ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
[RFC v2 1/2] virtio: add pmem driver
This patch adds virtio-pmem driver for KVM guest. Guest reads the persistent memory range information from Qemu over VIRTIO and registers it on nvdimm_bus. It also creates a nd_region object with the persistent memory range information so that existing 'nvdimm/pmem' driver can reserve this into system memory map. This way 'virtio-pmem' driver uses existing functionality of pmem driver to register persistent memory compatible for DAX capable filesystems. This also provides function to perform guest flush over VIRTIO from 'pmem' driver when userspace performs flush on DAX memory range. Signed-off-by: Pankaj Gupta --- drivers/virtio/Kconfig | 12 drivers/virtio/Makefile | 1 + drivers/virtio/virtio_pmem.c | 118 +++ include/linux/libnvdimm.h| 4 ++ include/uapi/linux/virtio_ids.h | 1 + include/uapi/linux/virtio_pmem.h | 58 +++ 6 files changed, 194 insertions(+) create mode 100644 drivers/virtio/virtio_pmem.c create mode 100644 include/uapi/linux/virtio_pmem.h diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig index 3589764..879335d 100644 --- a/drivers/virtio/Kconfig +++ b/drivers/virtio/Kconfig @@ -42,6 +42,18 @@ config VIRTIO_PCI_LEGACY If unsure, say Y. +config VIRTIO_PMEM + tristate "Virtio pmem driver" + depends on VIRTIO + help +This driver adds persistent memory range to nd_region and registers +with nvdimm bus. NVDIMM 'pmem' driver later allocates a persistent +memory range on the memory information added by this driver. In addition +to this, 'virtio-pmem' driver also provides a paravirt flushing interface +from guest to host. + +If unsure, say M. + config VIRTIO_BALLOON tristate "Virtio balloon driver" depends on VIRTIO diff --git a/drivers/virtio/Makefile b/drivers/virtio/Makefile index 3a2b5c5..cbe91c6 100644 --- a/drivers/virtio/Makefile +++ b/drivers/virtio/Makefile @@ -6,3 +6,4 @@ virtio_pci-y := virtio_pci_modern.o virtio_pci_common.o virtio_pci-$(CONFIG_VIRTIO_PCI_LEGACY) += virtio_pci_legacy.o obj-$(CONFIG_VIRTIO_BALLOON) += virtio_balloon.o obj-$(CONFIG_VIRTIO_INPUT) += virtio_input.o +obj-$(CONFIG_VIRTIO_PMEM) += virtio_pmem.o diff --git a/drivers/virtio/virtio_pmem.c b/drivers/virtio/virtio_pmem.c new file mode 100644 index 000..0906d2d --- /dev/null +++ b/drivers/virtio/virtio_pmem.c @@ -0,0 +1,118 @@ +/* Virtio pmem Driver + * + * Discovers persitent memory range information + * from host and provides a virtio based flushing + * interface. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static int init_vq(struct virtio_pmem *vpmem) +{ + struct virtqueue *vq; + + /* single vq */ + vpmem->req_vq = vq = virtio_find_single_vq(vpmem->vdev, + NULL, "flush_queue"); + + if (IS_ERR(vq)) + return PTR_ERR(vq); + + return 0; +}; + +static int virtio_pmem_probe(struct virtio_device *vdev) +{ + int err = 0; + struct resource res; + struct virtio_pmem *vpmem; + struct nvdimm_bus *nvdimm_bus; + struct nd_region_desc ndr_desc; + int nid = dev_to_node(&vdev->dev); + static struct nvdimm_bus_descriptor nd_desc; + + if (!vdev->config->get) { + dev_err(&vdev->dev, "%s failure: config disabled\n", + __func__); + return -EINVAL; + } + + vdev->priv = vpmem = devm_kzalloc(&vdev->dev, sizeof(*vpmem), + GFP_KERNEL); + if (!vpmem) { + err = -ENOMEM; + goto out; + } + + vpmem->vdev = vdev; + err = init_vq(vpmem); + if (err) + goto out; + + virtio_cread(vpmem->vdev, struct virtio_pmem_config, + start, &vpmem->start); + virtio_cread(vpmem->vdev, struct virtio_pmem_config, + size, &vpmem->size); + + res.start = vpmem->start; + res.end = vpmem->start + vpmem->size-1; + + memset(&nd_desc, 0, sizeof(nd_desc)); + nd_desc.provider_name = "virtio-pmem"; + nd_desc.module = THIS_MODULE; + nvdimm_bus = nvdimm_bus_register(&vdev->dev, &nd_desc); + + if (!nvdimm_bus) + goto out_nd; + dev_set_drvdata(&vdev->dev, nvdimm_bus); + + memset(&ndr_desc, 0, sizeof(ndr_desc)); + ndr_desc.res = &res; + ndr_desc.numa_node = nid; + set_bit(ND_REGION_PAGEMAP, &ndr_desc.flags); + set_bit(ND_REGION_VIRTIO, &ndr_desc.flags); + + if (!nvdimm_pmem_region_create(nvdimm_bus, &ndr_desc)) + goto out_nd; + + virtio_device_ready(vdev); + return 0; + +out_nd: + nvdimm_bus_unregister(nvdimm_bus); +out: + dev_err(&vdev->dev, "failed to register virtio pmem memory\n"); + vdev->
[RFC v2 2/2] pmem: device flush over VIRTIO
This patch adds functionality to perform flush from guest to hosy over VIRTIO when 'ND_REGION_VIRTIO'flag is set on nd_negion. Flag is set by 'virtio-pmem' driver. Signed-off-by: Pankaj Gupta --- drivers/nvdimm/region_devs.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c index a612be6..6c6454e 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c @@ -20,6 +20,7 @@ #include #include "nd-core.h" #include "nd.h" +#include /* * For readq() and writeq() on 32-bit builds, the hi-lo, lo-hi order is @@ -1074,6 +1075,12 @@ void nvdimm_flush(struct nd_region *nd_region) struct nd_region_data *ndrd = dev_get_drvdata(&nd_region->dev); int i, idx; + /* call PV device flush */ + if (test_bit(ND_REGION_VIRTIO, &nd_region->flags)) { + virtio_pmem_flush(&nd_region->dev); + return; + } + /* * Try to encourage some diversity in flush hint addresses * across cpus assuming a limited number of flush hints. -- 2.9.3 ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
[RFC v2 0/2] kvm "fake DAX" device flushing
This is RFC V2 for 'fake DAX' flushing interface sharing for review. This patchset has two main parts: - Guest virtio-pmem driver Guest driver reads persistent memory range from paravirt device and registers with 'nvdimm_bus'. 'nvdimm/pmem' driver uses this information to allocate persistent memory range. Also, we have implemented guest side of VIRTIO flushing interface. - Qemu virtio-pmem device It exposes a persistent memory range to KVM guest which at host side is file backed memory and works as persistent memory device. In addition to this it provides virtio device handling of flushing interface. KVM guest performs Qemu side asynchronous sync using this interface. Changes from previous RFC[1]: - Reuse existing 'pmem' code for registering persistent memory and other operations instead of creating an entirely new block driver. - Use VIRTIO driver to register memory information with nvdimm_bus and create region_type accordingly. - Call VIRTIO flush from existing pmem driver. Details of project idea for 'fake DAX' flushing interface is shared [2] & [3]. Pankaj Gupta (2): Add virtio-pmem guest driver pmem: device flush over VIRTIO [1] https://marc.info/?l=linux-mm&m=150782346802290&w=2 [2] https://www.spinics.net/lists/kvm/msg149761.html [3] https://www.spinics.net/lists/kvm/msg153095.html drivers/nvdimm/region_devs.c |7 ++ drivers/virtio/Kconfig | 12 +++ drivers/virtio/Makefile |1 drivers/virtio/virtio_pmem.c | 118 +++ include/linux/libnvdimm.h|4 + include/uapi/linux/virtio_ids.h |1 include/uapi/linux/virtio_pmem.h | 58 +++ 7 files changed, 201 insertions(+) ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
[RFC v2] qemu: Add virtio pmem device
This patch adds virtio-pmem Qemu device. This device presents memory address range information to guest which is backed by file backend type. It acts like persistent memory device for KVM guest. Guest can perform read and persistent write operations on this memory range with the help of DAX capable filesystem. Persistent guest writes are assured with the help of virtio based flushing interface. When guest userspace space performs fsync on file fd on pmem device, a flush command is send to Qemu over VIRTIO and host side flush/sync is done on backing image file. This PV device code is dependent and tested with 'David Hildenbrand's ' patchset[1] to map non-PCDIMM devices to guest address space. There is still upstream discussion on using among PCI bar vs memory device, will update as per concensus. [1] https://marc.info/?l=qemu-devel&m=152450249319168&w=2 Signed-off-by: Pankaj Gupta --- hw/virtio/Makefile.objs | 3 + hw/virtio/virtio-pci.c | 44 +++ hw/virtio/virtio-pci.h | 14 ++ hw/virtio/virtio-pmem.c | 197 include/hw/pci/pci.h| 1 + include/hw/virtio/virtio-pmem.h | 44 +++ include/standard-headers/linux/virtio_ids.h | 1 + qapi/misc.json | 26 +++- 8 files changed, 329 insertions(+), 1 deletion(-) create mode 100644 hw/virtio/virtio-pmem.c create mode 100644 include/hw/virtio/virtio-pmem.h diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index 765d363c1f..d329dbb1a1 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -6,6 +6,9 @@ common-obj-y += virtio-mmio.o obj-y += virtio.o virtio-balloon.o obj-$(CONFIG_LINUX) += vhost.o vhost-backend.o vhost-user.o +ifeq ($(CONFIG_MEM_HOTPLUG),y) +obj-$(CONFIG_LINUX) += virtio-pmem.o +endif obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o obj-y += virtio-crypto.o obj-$(CONFIG_VIRTIO_PCI) += virtio-crypto-pci.o diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 1e8ab7bbc5..e15a3a5a2e 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -2501,6 +2501,49 @@ static const TypeInfo virtio_rng_pci_info = { .class_init= virtio_rng_pci_class_init, }; +/* virtio-pmem-pci */ + +static void virtio_pmem_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) +{ +VirtIOPMEMPCI *vpmem = VIRTIO_PMEM_PCI(vpci_dev); +DeviceState *vdev = DEVICE(&vpmem->vdev); + +qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); +object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static void virtio_pmem_pci_class_init(ObjectClass *klass, void *data) +{ +DeviceClass *dc = DEVICE_CLASS(klass); +VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass); +PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass); +k->realize = virtio_pmem_pci_realize; +set_bit(DEVICE_CATEGORY_MISC, dc->categories); +pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET; +pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_PMEM; +pcidev_k->revision = VIRTIO_PCI_ABI_VERSION; +pcidev_k->class_id = PCI_CLASS_OTHERS; +} + +static void virtio_pmem_pci_instance_init(Object *obj) +{ +VirtIOPMEMPCI *dev = VIRTIO_PMEM_PCI(obj); + +virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), +TYPE_VIRTIO_PMEM); +object_property_add_alias(obj, "memdev", OBJECT(&dev->vdev), "memdev", + &error_abort); +} + +static const TypeInfo virtio_pmem_pci_info = { +.name = TYPE_VIRTIO_PMEM_PCI, +.parent= TYPE_VIRTIO_PCI, +.instance_size = sizeof(VirtIOPMEMPCI), +.instance_init = virtio_pmem_pci_instance_init, +.class_init= virtio_pmem_pci_class_init, +}; + + /* virtio-input-pci */ static Property virtio_input_pci_properties[] = { @@ -2693,6 +2736,7 @@ static void virtio_pci_register_types(void) type_register_static(&virtio_balloon_pci_info); type_register_static(&virtio_serial_pci_info); type_register_static(&virtio_net_pci_info); +type_register_static(&virtio_pmem_pci_info); #ifdef CONFIG_VHOST_SCSI type_register_static(&vhost_scsi_pci_info); #endif diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 813082b0d7..fe74fcad3f 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -19,6 +19,7 @@ #include "hw/virtio/virtio-blk.h" #include "hw/virtio/virtio-net.h" #include "hw/virtio/virtio-rng.h" +#include "hw/virtio/virtio-pmem.h" #include "hw/virtio/virtio-serial.h" #include "hw/virtio/virtio-scsi.h" #include "hw/virtio/virtio-balloon.h" @@ -57,6 +58,7 @@ typedef struct VirtIOInputHostPCI VirtIOInputHostPCI; typedef struct VirtIOGPUPCI VirtIOGPUPCI; typedef struct VHostVSockPCI VHostVSockPCI; typedef struct VirtIOCryptoPCI VirtIOCryptoPCI; +typedef struct VirtIOPMEMPCI VirtIOPMEMPCI; /* virtio-pci-bus */ @@ -274,6 +276,18 @@ struct VirtIOBlkP
Re: [Qemu-devel] [RFC v2] qemu: Add virtio pmem device
Hi, This series failed build test on s390x host. Please find the details below. Type: series Message-id: 20180425112415.12327-4-pagu...@redhat.com Subject: [Qemu-devel] [RFC v2] qemu: Add virtio pmem device === TEST SCRIPT BEGIN === #!/bin/bash # Testing script will be invoked under the git checkout with # HEAD pointing to a commit that has the patches applied on top of "base" # branch set -e echo "=== ENV ===" env echo "=== PACKAGES ===" rpm -qa echo "=== TEST BEGIN ===" CC=$HOME/bin/cc INSTALL=$PWD/install BUILD=$PWD/build echo -n "Using CC: " realpath $CC mkdir -p $BUILD $INSTALL SRC=$PWD cd $BUILD $SRC/configure --cc=$CC --prefix=$INSTALL make -j4 # XXX: we need reliable clean up # make check -j4 V=1 make install === TEST SCRIPT END === Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 >From https://github.com/patchew-project/qemu * [new tag] patchew/20180425112415.12327-4-pagu...@redhat.com -> patchew/20180425112415.12327-4-pagu...@redhat.com Switched to a new branch 'test' 303e952759 qemu: Add virtio pmem device === OUTPUT BEGIN === === ENV === LANG=en_US.UTF-8 XDG_SESSION_ID=154150 USER=fam PWD=/var/tmp/patchew-tester-tmp-ypl5ou86/src HOME=/home/fam SHELL=/bin/sh SHLVL=2 PATCHEW=/home/fam/patchew/patchew-cli -s http://patchew.org --nodebug LOGNAME=fam DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1012/bus XDG_RUNTIME_DIR=/run/user/1012 PATH=/usr/bin:/bin _=/usr/bin/env === PACKAGES === gpg-pubkey-873529b8-54e386ff glibc-debuginfo-common-2.24-10.fc25.s390x fedora-release-26-1.noarch dejavu-sans-mono-fonts-2.35-4.fc26.noarch xemacs-filesystem-21.5.34-22.20170124hgf412e9f093d4.fc26.noarch bash-4.4.12-7.fc26.s390x libSM-1.2.2-5.fc26.s390x libmpc-1.0.2-6.fc26.s390x libaio-0.3.110-7.fc26.s390x libverto-0.2.6-7.fc26.s390x perl-Scalar-List-Utils-1.48-1.fc26.s390x iptables-libs-1.6.1-2.fc26.s390x tcl-8.6.6-2.fc26.s390x libxshmfence-1.2-4.fc26.s390x expect-5.45-23.fc26.s390x perl-Thread-Queue-3.12-1.fc26.noarch perl-encoding-2.19-6.fc26.s390x keyutils-1.5.10-1.fc26.s390x gmp-devel-6.1.2-4.fc26.s390x enchant-1.6.0-16.fc26.s390x python-gobject-base-3.24.1-1.fc26.s390x python3-enchant-1.6.10-1.fc26.noarch python-lockfile-0.11.0-6.fc26.noarch python2-pyparsing-2.1.10-3.fc26.noarch python2-lxml-4.1.1-1.fc26.s390x librados2-10.2.7-2.fc26.s390x trousers-lib-0.3.13-7.fc26.s390x libdatrie-0.2.9-4.fc26.s390x libsoup-2.58.2-1.fc26.s390x passwd-0.79-9.fc26.s390x bind99-libs-9.9.10-3.P3.fc26.s390x python3-rpm-4.13.0.2-1.fc26.s390x systemd-233-7.fc26.s390x virglrenderer-0.6.0-1.20170210git76b3da97b.fc26.s390x s390utils-ziomon-1.36.1-3.fc26.s390x s390utils-osasnmpd-1.36.1-3.fc26.s390x libXrandr-1.5.1-2.fc26.s390x libglvnd-glx-1.0.0-1.fc26.s390x texlive-ifxetex-svn19685.0.5-33.fc26.2.noarch texlive-psnfss-svn33946.9.2a-33.fc26.2.noarch texlive-dvipdfmx-def-svn40328-33.fc26.2.noarch texlive-natbib-svn20668.8.31b-33.fc26.2.noarch texlive-xdvi-bin-svn40750-33.20160520.fc26.2.s390x texlive-cm-svn32865.0-33.fc26.2.noarch texlive-beton-svn15878.0-33.fc26.2.noarch texlive-fpl-svn15878.1.002-33.fc26.2.noarch texlive-mflogo-svn38628-33.fc26.2.noarch texlive-texlive-docindex-svn41430-33.fc26.2.noarch texlive-luaotfload-bin-svn34647.0-33.20160520.fc26.2.noarch texlive-koma-script-svn41508-33.fc26.2.noarch texlive-pst-tree-svn24142.1.12-33.fc26.2.noarch texlive-breqn-svn38099.0.98d-33.fc26.2.noarch texlive-xetex-svn41438-33.fc26.2.noarch gstreamer1-plugins-bad-free-1.12.3-1.fc26.s390x xorg-x11-font-utils-7.5-33.fc26.s390x ghostscript-fonts-5.50-36.fc26.noarch libXext-devel-1.3.3-5.fc26.s390x libusbx-devel-1.0.21-2.fc26.s390x libglvnd-devel-1.0.0-1.fc26.s390x emacs-25.3-3.fc26.s390x alsa-lib-devel-1.1.4.1-1.fc26.s390x kbd-2.0.4-2.fc26.s390x dconf-0.26.0-2.fc26.s390x mc-4.8.19-5.fc26.s390x doxygen-1.8.13-9.fc26.s390x dpkg-1.18.24-1.fc26.s390x libtdb-1.3.13-1.fc26.s390x python2-pynacl-1.1.1-1.fc26.s390x perl-Filter-1.58-1.fc26.s390x python2-pip-9.0.1-11.fc26.noarch dnf-2.7.5-2.fc26.noarch bind-license-9.11.2-1.P1.fc26.noarch libtasn1-4.13-1.fc26.s390x cpp-7.3.1-2.fc26.s390x pkgconf-1.3.12-2.fc26.s390x python2-fedora-0.10.0-1.fc26.noarch cmake-filesystem-3.10.1-11.fc26.s390x python3-requests-kerberos-0.12.0-1.fc26.noarch libmicrohttpd-0.9.59-1.fc26.s390x GeoIP-GeoLite-data-2018.01-1.fc26.noarch python2-libs-2.7.14-7.fc26.s390x libidn2-2.0.4-3.fc26.s390x p11-kit-devel-0.23.10-1.fc26.s390x perl-Errno-1.25-396.fc26.s390x libdrm-2.4.90-2.fc26.s390x sssd-common-1.16.1-1.fc26.s390x boost-random-1.63.0-11.fc26.s390x urw-fonts-2.4-24.fc26.noarch ccache-3.3.6-1.fc26.s390x glibc-debuginfo-2.24-10.fc25.s390x dejavu-fonts-common-2.35-4.fc26.noarch bind99-license-9.9.10-3.P3.fc26.noarch ncurses-libs-6.0-8.20170212.fc26.s390x libpng-1.6.28-2.fc26.s390x libICE-1.0.9-9.fc26.s390x perl-Text-ParseWords-3.30-366.fc26.noarch libtool-ltdl-2.4.6-17.fc26.s390x libselinux-utils-2.6-7.fc26.s390x userspace-rcu-0.9.3-2.fc26.s390x perl-Class-Inspector-1.31-3.fc26.noarch keyutils-libs-devel-1.5.10-1.fc26.s390x isl-0.16.1-1.fc26.s390x libsecret-0.18.
Re: [Qemu-devel] [RFC v2] qemu: Add virtio pmem device
Hi, This series failed docker-build@min-glib build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally. Type: series Message-id: 20180425112415.12327-4-pagu...@redhat.com Subject: [Qemu-devel] [RFC v2] qemu: Add virtio pmem device === TEST SCRIPT BEGIN === #!/bin/bash set -e git submodule update --init dtc # Let docker tests dump environment info export SHOW_ENV=1 export J=8 time make docker-test-build@min-glib === TEST SCRIPT END === Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 Switched to a new branch 'test' 303e952759 qemu: Add virtio pmem device === OUTPUT BEGIN === Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc' Cloning into '/var/tmp/patchew-tester-tmp-sqsog4o6/src/dtc'... Submodule path 'dtc': checked out 'e54388015af1fb4bf04d0bca99caba1074d9cc42' BUILD min-glib make[1]: Entering directory '/var/tmp/patchew-tester-tmp-sqsog4o6/src' GEN /var/tmp/patchew-tester-tmp-sqsog4o6/src/docker-src.2018-04-25-07.43.07.4422/qemu.tar Cloning into '/var/tmp/patchew-tester-tmp-sqsog4o6/src/docker-src.2018-04-25-07.43.07.4422/qemu.tar.vroot'... done. Your branch is up-to-date with 'origin/test'. Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc' Cloning into '/var/tmp/patchew-tester-tmp-sqsog4o6/src/docker-src.2018-04-25-07.43.07.4422/qemu.tar.vroot/dtc'... Submodule path 'dtc': checked out 'e54388015af1fb4bf04d0bca99caba1074d9cc42' Submodule 'ui/keycodemapdb' (git://git.qemu.org/keycodemapdb.git) registered for path 'ui/keycodemapdb' Cloning into '/var/tmp/patchew-tester-tmp-sqsog4o6/src/docker-src.2018-04-25-07.43.07.4422/qemu.tar.vroot/ui/keycodemapdb'... Submodule path 'ui/keycodemapdb': checked out '6b3d716e2b6472eb7189d3220552280ef3d832ce' COPYRUNNER RUN test-build in qemu:min-glib Environment variables: HOSTNAME=ba95bf6d7097 MAKEFLAGS= -j8 J=8 CCACHE_DIR=/var/tmp/ccache EXTRA_CONFIGURE_OPTS= V= SHOW_ENV=1 PATH=/usr/lib/ccache:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PWD=/ TARGET_LIST= SHLVL=1 HOME=/root TEST_DIR=/tmp/qemu-test FEATURES= dtc DEBUG= _=/usr/bin/env Configure options: --enable-werror --target-list=x86_64-softmmu,aarch64-softmmu --prefix=/tmp/qemu-test/install No C++ compiler available; disabling C++ specific optional code Install prefix/tmp/qemu-test/install BIOS directory/tmp/qemu-test/install/share/qemu firmware path /tmp/qemu-test/install/share/qemu-firmware binary directory /tmp/qemu-test/install/bin library directory /tmp/qemu-test/install/lib module directory /tmp/qemu-test/install/lib/qemu libexec directory /tmp/qemu-test/install/libexec include directory /tmp/qemu-test/install/include config directory /tmp/qemu-test/install/etc local state directory /tmp/qemu-test/install/var Manual directory /tmp/qemu-test/install/share/man ELF interp prefix /usr/gnemul/qemu-%M Source path /tmp/qemu-test/src GIT binarygit GIT submodules C compilercc Host C compiler cc C++ compiler Objective-C compiler cc ARFLAGS rv CFLAGS-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g QEMU_CFLAGS -I/usr/include/pixman-1 -I$(SRC_PATH)/dtc/libfdt -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wendif-labels -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-all -Wno-missing-braces LDFLAGS -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g make make install install pythonpython -B smbd /usr/sbin/smbd module supportno host CPU x86_64 host big endian no target list x86_64-softmmu aarch64-softmmu gprof enabled no sparse enabledno strip binariesyes profiler no static build no SDL support yes (1.2.14) GTK support no GTK GL supportno VTE support no TLS priority NORMAL GNUTLS supportno GNUTLS rndno libgcrypt no libgcrypt kdf no nettleno nettle kdfno libtasn1 no curses supportno virgl support no curl support no mingw32 support no Audio drivers oss Block whitelist (rw) Block whitelist (ro) VirtFS supportno Multipath support no VNC support yes VNC SASL support no VNC JPEG support no VNC PNG support no xen support no brlapi supportno bluez supportno Documentation no PIE yes vde support no netmap supportno Linux AIO support no ATTR/XATTR support yes Install blobs yes KVM support yes HAX suppo
Re: [Qemu-devel] [RFC v2] qemu: Add virtio pmem device
Hi, Compile failures are because Qemu 'Memory-Device changes' are not yet in qemu master. As mentioned in Qemu patch message patch is dependent on 'Memeory-device' patches by 'David Hildenbrand'. Already picked up by maintainer. > Hi, > > This series failed build test on s390x host. Please find the details below. > > Type: series > Message-id: 20180425112415.12327-4-pagu...@redhat.com > Subject: [Qemu-devel] [RFC v2] qemu: Add virtio pmem device > > === TEST SCRIPT BEGIN === > #!/bin/bash > # Testing script will be invoked under the git checkout with > # HEAD pointing to a commit that has the patches applied on top of "base" > # branch > set -e > echo "=== ENV ===" > env > echo "=== PACKAGES ===" > rpm -qa > echo "=== TEST BEGIN ===" > CC=$HOME/bin/cc > INSTALL=$PWD/install > BUILD=$PWD/build > echo -n "Using CC: " > realpath $CC > mkdir -p $BUILD $INSTALL > SRC=$PWD > cd $BUILD > $SRC/configure --cc=$CC --prefix=$INSTALL > make -j4 > # XXX: we need reliable clean up > # make check -j4 V=1 > make install > === TEST SCRIPT END === > > Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 > From https://github.com/patchew-project/qemu > * [new tag] patchew/20180425112415.12327-4-pagu...@redhat.com > -> patchew/20180425112415.12327-4-pagu...@redhat.com > Switched to a new branch 'test' > 303e952759 qemu: Add virtio pmem device > > === OUTPUT BEGIN === > === ENV === > LANG=en_US.UTF-8 > XDG_SESSION_ID=154150 > USER=fam > PWD=/var/tmp/patchew-tester-tmp-ypl5ou86/src > HOME=/home/fam > SHELL=/bin/sh > SHLVL=2 > PATCHEW=/home/fam/patchew/patchew-cli -s http://patchew.org --nodebug > LOGNAME=fam > DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1012/bus > XDG_RUNTIME_DIR=/run/user/1012 > PATH=/usr/bin:/bin > _=/usr/bin/env > === PACKAGES === > gpg-pubkey-873529b8-54e386ff > glibc-debuginfo-common-2.24-10.fc25.s390x > fedora-release-26-1.noarch > dejavu-sans-mono-fonts-2.35-4.fc26.noarch > xemacs-filesystem-21.5.34-22.20170124hgf412e9f093d4.fc26.noarch > bash-4.4.12-7.fc26.s390x > libSM-1.2.2-5.fc26.s390x > libmpc-1.0.2-6.fc26.s390x > libaio-0.3.110-7.fc26.s390x > libverto-0.2.6-7.fc26.s390x > perl-Scalar-List-Utils-1.48-1.fc26.s390x > iptables-libs-1.6.1-2.fc26.s390x > tcl-8.6.6-2.fc26.s390x > libxshmfence-1.2-4.fc26.s390x > expect-5.45-23.fc26.s390x > perl-Thread-Queue-3.12-1.fc26.noarch > perl-encoding-2.19-6.fc26.s390x > keyutils-1.5.10-1.fc26.s390x > gmp-devel-6.1.2-4.fc26.s390x > enchant-1.6.0-16.fc26.s390x > python-gobject-base-3.24.1-1.fc26.s390x > python3-enchant-1.6.10-1.fc26.noarch > python-lockfile-0.11.0-6.fc26.noarch > python2-pyparsing-2.1.10-3.fc26.noarch > python2-lxml-4.1.1-1.fc26.s390x > librados2-10.2.7-2.fc26.s390x > trousers-lib-0.3.13-7.fc26.s390x > libdatrie-0.2.9-4.fc26.s390x > libsoup-2.58.2-1.fc26.s390x > passwd-0.79-9.fc26.s390x > bind99-libs-9.9.10-3.P3.fc26.s390x > python3-rpm-4.13.0.2-1.fc26.s390x > systemd-233-7.fc26.s390x > virglrenderer-0.6.0-1.20170210git76b3da97b.fc26.s390x > s390utils-ziomon-1.36.1-3.fc26.s390x > s390utils-osasnmpd-1.36.1-3.fc26.s390x > libXrandr-1.5.1-2.fc26.s390x > libglvnd-glx-1.0.0-1.fc26.s390x > texlive-ifxetex-svn19685.0.5-33.fc26.2.noarch > texlive-psnfss-svn33946.9.2a-33.fc26.2.noarch > texlive-dvipdfmx-def-svn40328-33.fc26.2.noarch > texlive-natbib-svn20668.8.31b-33.fc26.2.noarch > texlive-xdvi-bin-svn40750-33.20160520.fc26.2.s390x > texlive-cm-svn32865.0-33.fc26.2.noarch > texlive-beton-svn15878.0-33.fc26.2.noarch > texlive-fpl-svn15878.1.002-33.fc26.2.noarch > texlive-mflogo-svn38628-33.fc26.2.noarch > texlive-texlive-docindex-svn41430-33.fc26.2.noarch > texlive-luaotfload-bin-svn34647.0-33.20160520.fc26.2.noarch > texlive-koma-script-svn41508-33.fc26.2.noarch > texlive-pst-tree-svn24142.1.12-33.fc26.2.noarch > texlive-breqn-svn38099.0.98d-33.fc26.2.noarch > texlive-xetex-svn41438-33.fc26.2.noarch > gstreamer1-plugins-bad-free-1.12.3-1.fc26.s390x > xorg-x11-font-utils-7.5-33.fc26.s390x > ghostscript-fonts-5.50-36.fc26.noarch > libXext-devel-1.3.3-5.fc26.s390x > libusbx-devel-1.0.21-2.fc26.s390x > libglvnd-devel-1.0.0-1.fc26.s390x > emacs-25.3-3.fc26.s390x > alsa-lib-devel-1.1.4.1-1.fc26.s390x > kbd-2.0.4-2.fc26.s390x > dconf-0.26.0-2.fc26.s390x > mc-4.8.19-5.fc26.s390x > doxygen-1.8.13-9.fc26.s390x > dpkg-1.18.24-1.fc26.s390x > libtdb-1.3.13-1.fc26.s390x > python2-pynacl-1.1.1-1.fc26.s390x > perl-Filter-1.58-1.fc26.s390x > python2-pip-9.0.1-11.fc26.noarch > dnf-2.7.5-2.fc26.noarch > bind-license-9.11.2-1.P1.fc26.noarch > libtasn1-4.13-1.fc26.s390x > cpp-7.3.1-2.fc26.s390x > pkgconf-1.3.12-2.fc26.s390x > python2-fedora-0.10.0-1.fc26.noarch > cmake-filesystem-3.10.1-11.fc26.s390x > python3-requests-kerberos-0.12.0-1.fc26.noarch > libmicrohttpd-0.9.59-1.fc26.s390x > GeoIP-GeoLite-data-2018.01-1.fc26.noarch > python2-libs-2.7.14-7.fc26.s390x > libidn2-2.0.4-3.fc26.s390x > p11-kit-devel-0.23.10-1.fc26.s390x > perl-Errno-1.25-396.fc26.s390x > libdrm-2.4.90-2.fc26.s390x > sssd-common-1.16.1-1.fc26.s390x > boost-random-1.63.0-11.fc26.s390x >
Re: [PATCH] ndctl, filter: fix "keyword 'all' is ignored" in util__filter()
On Wed, Apr 25, 2018 at 12:38 AM, QI Fuli wrote: > This is a follow up patch for commit c70adc3cf6bf ("ndctl, filter: refactor > util__filter() to support multiple space-seperated arguments") > refactored util__filter() to support multiple space-seperated arguments. > But, when the keyword "all" is included in space-seperated arguments, > it will be treaded as 's name. This patch fixes it. > > Signed-off-by: QI Fuli > --- > util/filter.c | 12 > 1 file changed, 12 insertions(+) > > diff --git a/util/filter.c b/util/filter.c > index 0d3cc02..9081a6d 100644 > --- a/util/filter.c > +++ b/util/filter.c > @@ -40,6 +40,9 @@ struct ndctl_bus *util_bus_filter(struct ndctl_bus *bus, > const char *__ident) > > for (name = strtok_r(ident, " ", &save); name; > name = strtok_r(NULL, " ", &save)) { > + if (strcmp(ident, "all") == 0) > + break; > + Let's also remove the strcmp(__ident, "all") at the top of each of these routines to keep the check for "all" centralized. ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [RFC v2 1/2] virtio: add pmem driver
On Wed, Apr 25, 2018 at 4:24 AM, Pankaj Gupta wrote: > This patch adds virtio-pmem driver for KVM > guest. Minor nit, please expand your changelog line wrapping to 72 columns. > > Guest reads the persistent memory range > information from Qemu over VIRTIO and registers > it on nvdimm_bus. It also creates a nd_region > object with the persistent memory range > information so that existing 'nvdimm/pmem' > driver can reserve this into system memory map. > This way 'virtio-pmem' driver uses existing > functionality of pmem driver to register persistent > memory compatible for DAX capable filesystems. We need some additional enabling to disable MAP_SYNC for this configuration. In other words, if fsync() is required then we must disable the MAP_SYNC optimization. I think this should be a struct dax_device property looked up at mmap time in each MAP_SYNC capable ->mmap() file operation implementation. ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [RFC v2 2/2] pmem: device flush over VIRTIO
On Wed, Apr 25, 2018 at 4:24 AM, Pankaj Gupta wrote: > This patch adds functionality to perform > flush from guest to hosy over VIRTIO > when 'ND_REGION_VIRTIO'flag is set on > nd_negion. Flag is set by 'virtio-pmem' > driver. > > Signed-off-by: Pankaj Gupta > --- > drivers/nvdimm/region_devs.c | 7 +++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c > index a612be6..6c6454e 100644 > --- a/drivers/nvdimm/region_devs.c > +++ b/drivers/nvdimm/region_devs.c > @@ -20,6 +20,7 @@ > #include > #include "nd-core.h" > #include "nd.h" > +#include > > /* > * For readq() and writeq() on 32-bit builds, the hi-lo, lo-hi order is > @@ -1074,6 +1075,12 @@ void nvdimm_flush(struct nd_region *nd_region) > struct nd_region_data *ndrd = dev_get_drvdata(&nd_region->dev); > int i, idx; > > + /* call PV device flush */ > + if (test_bit(ND_REGION_VIRTIO, &nd_region->flags)) { > + virtio_pmem_flush(&nd_region->dev); > + return; > + } > + I'd rather introduce a ->flush() operation hanging off of 'struct nd_region' so that this multiplexing can be a static setting. ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [RFC v2 1/2] virtio: add pmem driver
[ adding Jeff directly since he has also been looking at infrastructure to track when MAP_SYNC should be disabled ] On Wed, Apr 25, 2018 at 7:21 AM, Dan Williams wrote: > On Wed, Apr 25, 2018 at 4:24 AM, Pankaj Gupta wrote: >> This patch adds virtio-pmem driver for KVM >> guest. > > Minor nit, please expand your changelog line wrapping to 72 columns. > >> >> Guest reads the persistent memory range >> information from Qemu over VIRTIO and registers >> it on nvdimm_bus. It also creates a nd_region >> object with the persistent memory range >> information so that existing 'nvdimm/pmem' >> driver can reserve this into system memory map. >> This way 'virtio-pmem' driver uses existing >> functionality of pmem driver to register persistent >> memory compatible for DAX capable filesystems. > > We need some additional enabling to disable MAP_SYNC for this > configuration. In other words, if fsync() is required then we must > disable the MAP_SYNC optimization. I think this should be a struct > dax_device property looked up at mmap time in each MAP_SYNC capable > ->mmap() file operation implementation. ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [RFC v2 2/2] pmem: device flush over VIRTIO
> > On Wed, Apr 25, 2018 at 4:24 AM, Pankaj Gupta wrote: > > This patch adds functionality to perform > > flush from guest to hosy over VIRTIO > > when 'ND_REGION_VIRTIO'flag is set on > > nd_negion. Flag is set by 'virtio-pmem' > > driver. > > > > Signed-off-by: Pankaj Gupta > > --- > > drivers/nvdimm/region_devs.c | 7 +++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c > > index a612be6..6c6454e 100644 > > --- a/drivers/nvdimm/region_devs.c > > +++ b/drivers/nvdimm/region_devs.c > > @@ -20,6 +20,7 @@ > > #include > > #include "nd-core.h" > > #include "nd.h" > > +#include > > > > /* > > * For readq() and writeq() on 32-bit builds, the hi-lo, lo-hi order is > > @@ -1074,6 +1075,12 @@ void nvdimm_flush(struct nd_region *nd_region) > > struct nd_region_data *ndrd = dev_get_drvdata(&nd_region->dev); > > int i, idx; > > > > + /* call PV device flush */ > > + if (test_bit(ND_REGION_VIRTIO, &nd_region->flags)) { > > + virtio_pmem_flush(&nd_region->dev); > > + return; > > + } > > + > > I'd rather introduce a ->flush() operation hanging off of 'struct > nd_region' so that this multiplexing can be a static setting. Sure! will make the change. Thanks, Pankaj ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [Qemu-devel] [RFC v2] qemu: Add virtio pmem device
> > Hi, > > > > Compile failures are because Qemu 'Memory-Device changes' are not yet > > in qemu master. As mentioned in Qemu patch message patch is > > dependent on 'Memeory-device' patches by 'David Hildenbrand'. > > > On 04/25/2018 06:24 AM, Pankaj Gupta wrote: > > This PV device code is dependent and tested > > with 'David Hildenbrand's ' patchset[1] to > > map non-PCDIMM devices to guest address space. > > There is still upstream discussion on using > > among PCI bar vs memory device, will update > > as per concensus. > > > > [1] https://marc.info/?l=qemu-devel&m=152450249319168&w=2 > > Then let's spell that in a way that patchew understands (since patchew > does not know how to turn marc.info references into Message-IDs): > > Based-on: <20180423165126.15441-1-da...@redhat.com> o.k Thank you! > > -- > Eric Blake, Principal Software Engineer > Red Hat, Inc. +1-919-301-3266 > Virtualization: qemu.org | libvirt.org > > ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [RFC v2 1/2] virtio: add pmem driver
On Wed, Apr 25, 2018 at 04:54:13PM +0530, Pankaj Gupta wrote: > diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h > index 6d5c3b2..5ebd049 100644 > --- a/include/uapi/linux/virtio_ids.h > +++ b/include/uapi/linux/virtio_ids.h > @@ -43,5 +43,6 @@ > #define VIRTIO_ID_INPUT18 /* virtio input */ > #define VIRTIO_ID_VSOCK19 /* virtio vsock transport */ > #define VIRTIO_ID_CRYPTO 20 /* virtio crypto */ > +#define VIRTIO_ID_PMEM 21 /* virtio pmem */ > > #endif /* _LINUX_VIRTIO_IDS_H */ Please register the device id with virtio TC. > diff --git a/include/uapi/linux/virtio_pmem.h > b/include/uapi/linux/virtio_pmem.h > new file mode 100644 > index 000..2ec27cb > --- /dev/null > +++ b/include/uapi/linux/virtio_pmem.h > @@ -0,0 +1,58 @@ > +/* Virtio pmem Driver > + * > + * Discovers persitent memory range information > + * from host and provides a virtio based flushing > + * interface. > + */ > + > +#ifndef _LINUX_VIRTIO_PMEM_H > +#define _LINUX_VIRTIO_PMEM_H > + > +#include > +#include > +#include > +#include > +#include > + > + > +struct virtio_pmem_config { > + don't add empty lines pls. > + uint64_t start; > + uint64_t size; Used LE fields for everything. > +}; > + > +struct virtio_pmem { > + > + struct virtio_device *vdev; > + struct virtqueue *req_vq; > + > + uint64_t start; > + uint64_t size; > +} __packed; This does not belong in uapi, and should not be packed either. > + > +static struct virtio_device_id id_table[] = { > + { VIRTIO_ID_PMEM, VIRTIO_DEV_ANY_ID }, > + { 0 }, > +}; > + > +void virtio_pmem_flush(struct device *dev) > +{ > + struct scatterlist sg; > + struct virtio_device *vdev = dev_to_virtio(dev->parent->parent); > + struct virtio_pmem *vpmem = vdev->priv; > + char *buf = "FLUSH"; > + int err; > + > + sg_init_one(&sg, buf, sizeof(buf)); > + > + err = virtqueue_add_outbuf(vpmem->req_vq, &sg, 1, buf, GFP_KERNEL); > + > + if (err) { > + dev_err(&vdev->dev, "failed to send command to virtio pmem > device\n"); > + return; > + } > + > + virtqueue_kick(vpmem->req_vq); > +}; this doesn't belong in uapi. > + > +#endif > -- > 2.9.3 ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [Qemu-devel] [RFC v2] qemu: Add virtio pmem device
> > On 04/25/2018 06:24 AM, Pankaj Gupta wrote: > > This patch adds virtio-pmem Qemu device. > > > > This device presents memory address range > > information to guest which is backed by file > > backend type. It acts like persistent memory > > device for KVM guest. Guest can perform read > > and persistent write operations on this memory > > range with the help of DAX capable filesystem. > > > > Persistent guest writes are assured with the > > help of virtio based flushing interface. When > > guest userspace space performs fsync on file > > fd on pmem device, a flush command is send to > > Qemu over VIRTIO and host side flush/sync is > > done on backing image file. > > > > This PV device code is dependent and tested > > with 'David Hildenbrand's ' patchset[1] to > > map non-PCDIMM devices to guest address space. > > This sentence doesn't belong in git history. It is better to put > information like this... > > > There is still upstream discussion on using > > among PCI bar vs memory device, will update > > as per concensus. > > s/concensus/consensus/ > > > > > [1] https://marc.info/?l=qemu-devel&m=152450249319168&w=2 > > > > Signed-off-by: Pankaj Gupta > > --- > > ...here, where it is part of the email, but not picked up by 'git am'. I see. Thanks! > > > > +++ b/qapi/misc.json > > @@ -2871,6 +2871,29 @@ > >} > > } > > > > +## > > +# @VirtioPMemDeviceInfo: > > +# > > +# VirtioPMem state information > > +# > > +# @id: device's ID > > +# > > +# @start: physical address, where device is mapped > > +# > > +# @size: size of memory that the device provides > > +# > > +# @memdev: memory backend linked with device > > +# > > +# Since: 2.13 > > +## > > +{ 'struct': 'VirtioPMemDeviceInfo', > > +'data': { '*id': 'str', > > + 'start': 'size', > > + 'size': 'size', > > TAB damage. o.k > > > + 'memdev': 'str' > > + } > > +} > > + > > ## > > # @MemoryDeviceInfo: > > # > > @@ -2880,7 +2903,8 @@ > > ## > > { 'union': 'MemoryDeviceInfo', > >'data': { 'dimm': 'PCDIMMDeviceInfo', > > -'nvdimm': 'PCDIMMDeviceInfo' > > +'nvdimm': 'PCDIMMDeviceInfo', > > + 'virtio-pmem': 'VirtioPMemDeviceInfo' > >} > > } > > > > > > -- > Eric Blake, Principal Software Engineer > Red Hat, Inc. +1-919-301-3266 > Virtualization: qemu.org | libvirt.org > > ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [Qemu-devel] [RFC v2 1/2] virtio: add pmem driver
> > On Wed, Apr 25, 2018 at 04:54:13PM +0530, Pankaj Gupta wrote: > > diff --git a/include/uapi/linux/virtio_ids.h > > b/include/uapi/linux/virtio_ids.h > > index 6d5c3b2..5ebd049 100644 > > --- a/include/uapi/linux/virtio_ids.h > > +++ b/include/uapi/linux/virtio_ids.h > > @@ -43,5 +43,6 @@ > > #define VIRTIO_ID_INPUT18 /* virtio input */ > > #define VIRTIO_ID_VSOCK19 /* virtio vsock transport */ > > #define VIRTIO_ID_CRYPTO 20 /* virtio crypto */ > > +#define VIRTIO_ID_PMEM 21 /* virtio pmem */ > > > > #endif /* _LINUX_VIRTIO_IDS_H */ > > Please register the device id with virtio TC. O.K Will create virtio spec and follow the procedure. > > > > diff --git a/include/uapi/linux/virtio_pmem.h > > b/include/uapi/linux/virtio_pmem.h > > new file mode 100644 > > index 000..2ec27cb > > --- /dev/null > > +++ b/include/uapi/linux/virtio_pmem.h > > @@ -0,0 +1,58 @@ > > +/* Virtio pmem Driver > > + * > > + * Discovers persitent memory range information > > + * from host and provides a virtio based flushing > > + * interface. > > + */ > > + > > +#ifndef _LINUX_VIRTIO_PMEM_H > > +#define _LINUX_VIRTIO_PMEM_H > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > + > > +struct virtio_pmem_config { > > + > > don't add empty lines pls. o.k > > > + uint64_t start; > > + uint64_t size; > > Used LE fields for everything. o.k > > > +}; > > + > > +struct virtio_pmem { > > + > > + struct virtio_device *vdev; > > + struct virtqueue *req_vq; > > + > > + uint64_t start; > > + uint64_t size; > > +} __packed; > > This does not belong in uapi, and should not be packed either. o.k > > > + > > +static struct virtio_device_id id_table[] = { > > + { VIRTIO_ID_PMEM, VIRTIO_DEV_ANY_ID }, > > + { 0 }, > > +}; > > + > > +void virtio_pmem_flush(struct device *dev) > > +{ > > + struct scatterlist sg; > > + struct virtio_device *vdev = dev_to_virtio(dev->parent->parent); > > + struct virtio_pmem *vpmem = vdev->priv; > > + char *buf = "FLUSH"; > > + int err; > > + > > + sg_init_one(&sg, buf, sizeof(buf)); > > + > > + err = virtqueue_add_outbuf(vpmem->req_vq, &sg, 1, buf, GFP_KERNEL); > > + > > + if (err) { > > + dev_err(&vdev->dev, "failed to send command to virtio pmem > > device\n"); > > + return; > > + } > > + > > + virtqueue_kick(vpmem->req_vq); > > +}; > > this doesn't belong in uapi. o.k. Thanks, Pankaj ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
[PATCH] pmem: fix badblocks population for raw mode
pmem_attach_disk() calls nvdimm_badblocks_populate() with resource range uninitialized in the case of raw mode. This leads the pmem driver to hit MCE despite of ARS reporting the range bad. Initialize 'bb_res' for raw mode. Fixes: e8d513483300 ("memremap: change devm_memremap_pages interface to use struct dev_pagemap") Signed-off-by: Toshi Kani Cc: Christoph Hellwig Cc: Dan Williams Cc: --- drivers/nvdimm/pmem.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 9d714926ecf5..2d7875209bce 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -367,9 +367,11 @@ static int pmem_attach_disk(struct device *dev, addr = devm_memremap_pages(dev, &pmem->pgmap); pmem->pfn_flags |= PFN_MAP; memcpy(&bb_res, &pmem->pgmap.res, sizeof(bb_res)); - } else + } else { addr = devm_memremap(dev, pmem->phys_addr, pmem->size, ARCH_MEMREMAP_PMEM); + memcpy(&bb_res, res, sizeof(bb_res)); + } /* * At release time the queue must be frozen before ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
转发linux-nvdimm:法律法规员工问题处理技巧
linux-nvdimm:1775 A.新《劳动合同法》《社会保险法》《工伤保险条例》《劳动争议调解仲裁法》实操应对策略 B.有效调岗调薪、裁员解雇及违纪问题员工处理技巧 2018年4月27--28日-上海(A单元) 2018年5月11--12日-广州(B单元) 2018年5月17--18日-深圳(B单元) 2018年5月24--25日-北京(B单元) 2018年5月28--29日-上海(B单元) ━ 【学员对象】董事长、总经理、副总经理、人力资源总监/经理/专员及人事行政管理人员、工会干部、法务人员及相关管理人员、相关律师等。 【费用】3200元/1人 ━ ●培-训-报-名-中-心: 报名咨询电话:0755-61288035 010-51661863 021-31261580 手机:18890700600 (微信同号)赵先生 ━ ●课 程 背 景: 2008年至今,随着《劳动合同法》《劳动争议调解仲裁法》《劳动合同法实施条例》《职工带薪年休假条例》《企业职工带薪年休假实施办法》《社会保险法》《职业病防治法》《工伤保险条例》《女职工劳动保护特别规定》《企业民主管理规定》《劳动争议司法解释(三)》《劳动争议司法解释(四)》《工伤保险司法解释》《劳务派遣暂行规定》《劳动人事争议仲裁办案规则》等法律法规的相继出台或修订,全国各地的劳动争议案件出现“井喷”“爆发”等现象!近几年,沿海发达地区及一二线城市的劳动争议案件依旧“稳中有涨”“持续递增”,而内地欠发达地区及三五线城市的劳动争议案件亦日趋增多! 2008年至今,大部分的劳动争议案件均以用人单位败诉告终!这些案件充分说明,“传统式、粗放式、随便式”的人力资源管理模式已经被完全否定,已经彻底落后,已经无法适应新的形势!用人单位的人力资源法律风险无处不在,广大用人单位很有必要尽快学习相关政策法律法规,掌握防范用工风险和化解劳动争议的技能技巧,掌握证明劳动者“不合格、不胜任、严重失职、严重违纪”的实操策略,以迅速构建行之有效的劳动争议风险防范机制,以迅速杜绝或减少劳动争议的发生及败诉的概率,以重新树立与持续维护用人单位的管理权威! 综上,我们特邀请我国著名的劳动法、劳动关系与劳动争议实战专家钟永棣老师主讲此培训课程。欢迎企事业单位积极组织相关人员参加此课程! ━ 课 程 特 色: 稀缺性:此课程将劳动法体系和薪酬绩效管理体系紧密相结合,国内极少出现此类课程。 针对性:课程内容精选了近几年主讲老师(及其专职团队)亲自处理过的且在不少用人单位内部也曾发生过的代表性案例,这些案例完全符合中国现阶段的大环境、大气候、大趋势,极具参考性和启发性。 新颖性:除前述提及的内容外,老师将随时结合最新的劳资热点,分析最新的司法判例,分享最新的实操策略。 实战性:实战沙盘演练,学员深入思考与充分互动,老师毫不保留倾囊相授;学员把错误留在课堂,把正确的观点、方法、工具、技能带回去。 ━ 课 程 收 益: 1、全面了解人力资源管理过程中的法律风险; 2、透彻理解与人力资源管理有关的政策法律法规; 3、深度培养预测、分析人力资源管理法律风险的思维; 4、系统掌握预防和应对法律风险的实战技能及方法工具…… ━ 【授_课_专_家_介_绍】资_深_劳_动_法_实_战_专_家 钟永棣 国内著名劳动法、劳动关系与劳动争议实战专家;劳动仲裁员、企业劳动争议预防应对专家、高级人力资源管理师、高级劳动关系协调师;国内第一批倡导、传播、实施“国家劳动法与企业薪酬绩效管理有机整合”的先行者;国内原创型、实战型、顾问型的培训师。 现任劳律通法律顾问服务中心首席顾问、上海德禾翰通律师事务所董事顾问;兼任时代光华、深圳外商投资企业协会、广州市劳动保障学会、广州市人力资源市场服务中心、广州市就业训练中心、广东省人力资源管理协会、香港工业总会、中山大学、浙江大学、华南理工大学等200多家培训公司、行业协会、有关机构单位的长期签约讲师\特聘顾问。 钟老师精通劳动政策法律法规和劳动仲裁、诉讼程序,擅长劳动用工风险的有效预防与劳动争议案件的精准应对,善于把劳动法律法规与企业人力资源管理有机整合,通晓企业劳动争议防范机制的构建和劳动用工管理体系的修正完善。钟老师经常在客户办公现场、培训现场为客户、学员即时起草、审查、修改相关制度、合同、文书,或分析具体案件,提出精准应对思路;钟老师独到的现场的专业功底,每次都赢得广大客户、学员发自内心的好评与100%的信服! 科班出身的钟老师,2000年至今一直从事与劳动法、劳动关系与劳动争议有关的工作;曾任劳动行政部门专职劳动仲裁员,曾获“广州市优秀劳动仲裁员”称号,期间审裁劳动争议案件400多宗;多年来累计代理劳动争议500多宗,参与薪酬绩效咨询项目20多个,审查完善400多家企业的人力资源管理规章制度。个人长期担任30多家(累计200多家)企业单位的人力资源管理法律顾问;以钟老师领衔的专家队伍,长期为企事业单位提供劳动法常年顾问及各种劳资专项咨询服务,客户满意度高达95%。 2008年至今,钟老师每年授课约100-130天。钟老师将枯燥的劳动政策法规溶入实际管理案例当中,将人力资源管理与劳动法有机地整合在一起;课程内容80%为真实案例、20%为必备的重点法条;学员参与讨论、互动,课程生动有趣,深入浅出,实战型超强,让学员即时学以致用!课程满意度高达95%,众多学员均表示:“第一次听到如此实战、实用、实效的劳动法课程!钟老师非常务实、不说教、没有商业味道,终于听到了让我不再后悔的精彩课程!” 钟老师先后在《广州日报》《南方都市报》《中国社会科学报》《人力资源》《香港工业总会月刊》等报刊、杂志、媒体发表专业文章或采访稿100多篇。 钟老师曾为以下客户提供咨询、顾问、内训(非公开课)服务:中国人寿、太平人寿、华康保险、广发银行、光大银行、建设银行、农业银行、工商银行、中国邮政、国家电网、中国邮政速递、中国邮政储蓄银行、携程旅行网、中铁集团、深圳机场、黄河水电开发、中烟集团、南粤物流、新南方集团、深圳爱施德股份、合生创展、中海地产、方圆地产、珠江监理、珠江投资、蒙牛奶粉、三新地产、养生堂药业、一品红药业、广州中一药业、华东医药、河北神威药业、广药集团、香港晶苑集团、广州电信、广东旺大集团、广州江丰实业、中远物流、欧时力服装、广州岭南集团、广州蔬果集团、广东交通集团、深圳运发集团、深圳东部公交、广州无线电集团、珠海拱北口岸、比亚迪汽车、纵横天地旅行网、蛇口船务运输股份、唐山冀东水泥、风神集团、中咨工程监理、高士线业、利海集团、化建集团、深圳水务监理、新广国际集团、美的集团、江苏大全集团、沿海地产控股、深圳华侨城、广东信源集团、京城控股、三一重工、广东华农温氏畜牧股份、国药物流集团广东公司、云南煤化工集团、浙江新大集团、云南驰宏锌锗股份、广州电力系统、信昌机器、云南鸿翔药业集团、广东广电网络股份公司、广州南洋电器、广汽部件、中国十七冶集团、中国通信服务、欧普照明、中广核集团、中国能源建设集团、佳通轮胎、山东赛轮集团、成都置信集团、中国移动、周大福、山东常林集团、益海嘉里集团、建滔化工集团、施耐德……千余家企业。 ━ ● 课 程 大 纲: A单元内容(共2天,20个以上经典案例) 专题一:招聘入职 专题二:劳动合同订立 专题三:试用期 专题四:无固定期限劳动合同 专题五:培训、保密与竞业限制 专题六:劳动关系解除与终止 专题七:社会保险法 专题八:劳动争议处理 B单元内容(共2天,20个以上经典案例) 专题一:违纪违规问题员工处理 1.劳动者往往拒绝签收处分、解雇通知书,如何应对? 2.问题员工往往拒绝提交《检讨书》或否认违纪违规事实,企业该如何收集证据? 3.对于违纪员工,应该在什么时间内处理? 4.怎样理解“严重违反用人单位的规章制度”? 5.如何在《惩罚条例》中描述“一般违纪”、“较重违纪”及“严重违纪”? 6.怎样理解与操作“严重失职,营私舞弊,给用人单位造成重大损害”? 7.如何界定“重大损害”,“重大损害”是否必须体现为造成直接的经济损失? 8.如何追究“严重失职、严重违纪违规”者的法律责任? 9.能否直接规定“禁止兼职,否则视为严重违纪违规”? 10.直线部门经理擅自口头辞退员工,仲裁机构往往认定企业非法解雇,企业该如何做,才避免案件败诉? 11.劳动者不辞而别、无故旷工,却主张被企业口头解雇,往往得到仲裁机构的支持,企业该如何做,才避免案件败诉? 12.劳动者被行政拘留、刑事拘留、司法拘留期间,劳动关系如何处理? 13.“录音录象”证据,仲裁与法院是否采信;企业内部OA系统上的资料能否作为证据使用;电子邮件、手机短信能否作为证据使用? 专题二:绩效管理与岗位调整 1.企业单方调整岗位,员工往往可被迫解除合同并索赔经济补偿,如何规避? 2.调岗时没有书面确认,员工到新岗位工作2个月后能否要求恢复到原岗位? 3.可否对“三期内”女职工进行调岗、调薪? 4.与员工协商调岗前,需要做哪些准备工作? 5.员工认同绩效结果,为什么在“不胜任工作”引发的争议中还是败诉? 6.为什么企业根据绩效结果支付员工绩效奖金,最终被认定非法克扣工资? 7.法律上如何证明劳动者“不能胜任工作”? 8.对绩效考核不合格的员工,如何合法辞退? 9.绩效正态分布往往强制划分5%的员工为不合格者,是否合法? 10.不称职等同于不胜任工作吗? 专题三:工资福利与薪酬调整 1.工资总额包括哪些工资明细? 2.新进员工薪资管理问题及处理技巧; 3.调整工作岗位后,如何单方调薪、降薪? 4.如何通过薪酬调整处理员工失职、违纪等问题? 5.什么情况下可以扣减员工的工资? 6.值班算不算加班,如何防范风险? 7.未经单位确认,劳动者自行加班,能否主张加班费? 8.年薪制的员工能否主张加班费? 9.如何设计工资构成以降低加班费成本? 10.员工主张入职以来的加班费,如何应对? 11.员工在工作日下班后加班,能否安排补休而不支付加班费? 12.内部规定“已离职员工无权获取年终奖”,真的有效吗? 专题四:工作时间与休息休假 1.每周6天,每天7小时,究竟加班了2小时还是7小时? 2.工作日停电停工休息,能否要求员工周日上班,补回停工休息日? 3.综合工时下,法定节假日是否属于总的工作时间内? 4.病假、医疗期、工伤假的享受条件及风险管控; 5.如何预防与应对员工泡病假? 6.产假、年休假、婚丧假的享受条件及风险管控; 7.实习生、反聘人员能否享受年休假? 8.用人单位是否必须批准员工请事假? 9.请事假,当月工资是以实际出勤天数计算还是以工资总额减去缺勤天数计算? 专题五:经济补偿 1.用人单位需向劳动者支付经济补偿的情形有哪些? 2.什么情况下用人单位需支付两倍的经济补偿? 3.违法解除下是否存在代通知金? 4.劳动者可否同时向用人单位主张经济补偿和赔偿金? 5.经济补偿计算的基数及标准如何确定? 6. 解除前12个月内员工休过医疗期,其平均工资如何认定? 7.经济补偿年限最高不超过十二年的适用范围? 8.如何计算《劳动合同法》生效前后的经济补偿年限? 9.如何理解“六个月以上不满一年的,按一年计算;不满六个月的,支付半个月工资的经济补偿”? 10.劳动合同法环境下“50%额外经济补偿金”是否继续适用? 专题六:规章制度与员工手册 1.企业人力
RE: [PATCH] ndctl, filter: fix "keyword 'all' is ignored" in util__filter()
> -Original Message- > From: Dan Williams [mailto:dan.j.willi...@intel.com] > Sent: Wednesday, April 25, 2018 11:11 PM > To: Qi, Fuli/斉 福利 > Cc: linux-nvdimm > Subject: Re: [PATCH] ndctl, filter: fix "keyword 'all' is ignored" in > util__filter() > > On Wed, Apr 25, 2018 at 12:38 AM, QI Fuli wrote: > > This is a follow up patch for commit c70adc3cf6bf ("ndctl, filter: > > refactor > > util__filter() to support multiple space-seperated arguments") > > refactored util__filter() to support multiple space-seperated > > arguments. > > But, when the keyword "all" is included in space-seperated arguments, > > it will be treaded as 's name. This patch fixes it. > > > > Signed-off-by: QI Fuli > > --- > > util/filter.c | 12 > > 1 file changed, 12 insertions(+) > > > > diff --git a/util/filter.c b/util/filter.c index 0d3cc02..9081a6d > > 100644 > > --- a/util/filter.c > > +++ b/util/filter.c > > @@ -40,6 +40,9 @@ struct ndctl_bus *util_bus_filter(struct ndctl_bus > > *bus, const char *__ident) > > > > for (name = strtok_r(ident, " ", &save); name; > > name = strtok_r(NULL, " ", &save)) { > > + if (strcmp(ident, "all") == 0) > > + break; > > + > > Let's also remove the strcmp(__ident, "all") at the top of each of these > routines to > keep the check for "all" centralized. > OK, Thank you! ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
[PATCH v2] ndctl, filter: fix "keyword 'all' is ignored" in util__filter()
This is a follow up patch for commit c70adc3cf6bf ("ndctl, filter: refactor util__filter() to support multiple space-seperated arguments") refactored util__filter() to support multiple space-seperated arguments. But, when the keyword "all" is included in space-seperated arguments, it will be treaded as 's name. This patch fixes it. Signed-off-by: QI Fuli Change log since v1: - Removing the strcmp(__ident, "all") == 0 at the top of util__filter() - Changing the strcmp(ident, "all") == 0 to strcmp(name, "all") == 0 --- util/filter.c | 20 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/util/filter.c b/util/filter.c index 0d3cc02..1734bce 100644 --- a/util/filter.c +++ b/util/filter.c @@ -31,7 +31,7 @@ struct ndctl_bus *util_bus_filter(struct ndctl_bus *bus, const char *__ident) unsigned long bus_id, id; const char *provider, *devname, *name; - if (!__ident || strcmp(__ident, "all") == 0) + if (!__ident) return bus; ident = strdup(__ident); @@ -40,6 +40,9 @@ struct ndctl_bus *util_bus_filter(struct ndctl_bus *bus, const char *__ident) for (name = strtok_r(ident, " ", &save); name; name = strtok_r(NULL, " ", &save)) { + if (strcmp(name, "all") == 0) + break; + bus_id = strtoul(ident, &end, 0); if (end == ident || end[0]) bus_id = ULONG_MAX; @@ -69,7 +72,7 @@ struct ndctl_region *util_region_filter(struct ndctl_region *region, const char *name, *region_name; unsigned long region_id, id; - if (!__ident || strcmp(__ident, "all") == 0) + if (!__ident) return region; ident = strdup(__ident); @@ -78,6 +81,9 @@ struct ndctl_region *util_region_filter(struct ndctl_region *region, for (name = strtok_r(ident, " ", &save); name; name = strtok_r(NULL, " ", &save)) { + if (strcmp(name, "all") == 0) + break; + region_id = strtoul(ident, &end, 0); if (end == ident || end[0]) region_id = ULONG_MAX; @@ -106,7 +112,7 @@ struct ndctl_namespace *util_namespace_filter(struct ndctl_namespace *ndns, const char *name; char *ident, *save; - if (!__ident || strcmp(__ident, "all") == 0) + if (!__ident) return ndns; ident = strdup(__ident); @@ -115,6 +121,9 @@ struct ndctl_namespace *util_namespace_filter(struct ndctl_namespace *ndns, for (name = strtok_r(ident, " ", &save); name; name = strtok_r(NULL, " ", &save)) { + if (strcmp(name, "all") == 0) + break; + if (strcmp(name, ndctl_namespace_get_devname(ndns)) == 0) break; @@ -137,7 +146,7 @@ struct ndctl_dimm *util_dimm_filter(struct ndctl_dimm *dimm, const char *name, *dimm_name; unsigned long dimm_id, id; - if (!__ident || strcmp(__ident, "all") == 0) + if (!__ident) return dimm; ident = strdup(__ident); @@ -146,6 +155,9 @@ struct ndctl_dimm *util_dimm_filter(struct ndctl_dimm *dimm, for (name = strtok_r(ident, " ", &save); name; name = strtok_r(NULL, " ", &save)) { + if (strcmp(name, "all") == 0) + break; + dimm_id = strtoul(ident, &end, 0); if (end == ident || end[0]) dimm_id = ULONG_MAX; -- 2.17.0.140.g0b0cc9f86 ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH v3 1/3] resource: Use list_head to link sibling resource
On Thu, Apr 19, 2018 at 08:18:46AM +0800, Baoquan He wrote: >The struct resource uses singly linked list to link siblings. It's not >easy to do reverse iteration on sibling list. So replace it with list_head. > Hi, Baoquan Besides changing the data structure, I have another proposal to do the reverse iteration. Which means it would not affect other users, if you just want a reverse iteration. BTW, I don't think Andrew suggest to use linked-list directly. What he wants is a better solution to your first proposal in https://patchwork.kernel.org/patch/10300819/. Below is my proposal of resource reverse iteration without changing current design. >From 5d7145d44fe48b98572a03884fa3a3aa82e3cef9 Mon Sep 17 00:00:00 2001 From: Wei Yang Date: Sat, 24 Mar 2018 23:25:46 +0800 Subject: [PATCH] kernel/resource: add walk_system_ram_res_rev() As discussed on https://patchwork.kernel.org/patch/10300819/, this patch comes up with a variant implementation of walk_system_ram_res_rev(), which uses iteration instead of allocating array to store those resources. Signed-off-by: Wei Yang --- include/linux/ioport.h | 3 ++ kernel/resource.c | 113 + 2 files changed, 116 insertions(+) diff --git a/include/linux/ioport.h b/include/linux/ioport.h index da0ebaec25f0..473f1d9cb97e 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -277,6 +277,9 @@ extern int walk_system_ram_res(u64 start, u64 end, void *arg, int (*func)(struct resource *, void *)); extern int +walk_system_ram_res_rev(u64 start, u64 end, void *arg, + int (*func)(struct resource *, void *)); +extern int walk_iomem_res_desc(unsigned long desc, unsigned long flags, u64 start, u64 end, void *arg, int (*func)(struct resource *, void *)); diff --git a/kernel/resource.c b/kernel/resource.c index 769109f20fb7..d4ec5fbc6875 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -73,6 +73,38 @@ static struct resource *next_resource(struct resource *p, bool sibling_only) return p->sibling; } +static struct resource *prev_resource(struct resource *p, bool sibling_only) +{ + struct resource *prev; + if (NULL == iomem_resource.child) + return NULL; + + if (p == NULL) { + prev = iomem_resource.child; + while (prev->sibling) + prev = prev->sibling; + } else { + if (p->parent->child == p) { + return p->parent; + } + + for (prev = p->parent->child; prev->sibling != p; + prev = prev->sibling) {} + } + + /* Caller wants to traverse through siblings only */ + if (sibling_only) + return prev; + + for (;prev->child;) { + prev = prev->child; + + while (prev->sibling) + prev = prev->sibling; + } + return prev; +} + static void *r_next(struct seq_file *m, void *v, loff_t *pos) { struct resource *p = v; @@ -401,6 +433,47 @@ static int find_next_iomem_res(struct resource *res, unsigned long desc, return 0; } +/* + * Finds the highest iomem resource existing within [res->start.res->end). + * The caller must specify res->start, res->end, res->flags, and optionally + * desc. If found, returns 0, res is overwritten, if not found, returns -1. + * This function walks the whole tree and not just first level children until + * and unless first_level_children_only is true. + */ +static int find_prev_iomem_res(struct resource *res, unsigned long desc, + bool first_level_children_only) +{ + struct resource *p; + + BUG_ON(!res); + BUG_ON(res->start >= res->end); + + read_lock(&resource_lock); + + for (p = prev_resource(NULL, first_level_children_only); p; + p = prev_resource(p, first_level_children_only)) { + if ((p->flags & res->flags) != res->flags) + continue; + if ((desc != IORES_DESC_NONE) && (desc != p->desc)) + continue; + if (p->end < res->start || p->child == iomem_resource.child) { + p = NULL; + break; + } + if ((p->end >= res->start) && (p->start < res->end)) + break; + } + + read_unlock(&resource_lock); + if (!p) + return -1; + /* copy data */ + resource_clip(res, p->start, p->end); + res->flags = p->flags; + res->desc = p->desc; + return 0; +} + static int __walk_iomem_res_desc(struct resource *res, unsigned long desc, bool first_level_children_only, void *arg, @@ -422,6 +495,27 @@ static int __walk_iomem_res_desc(struct resource *res, unsigned long desc, return r
Re: [PATCH v2] ndctl, filter: fix "keyword 'all' is ignored" in util__filter()
On Wed, Apr 25, 2018 at 5:56 PM, QI Fuli wrote: > This is a follow up patch for commit c70adc3cf6bf ("ndctl, filter: refactor > util__filter() to support multiple space-seperated arguments") > refactored util__filter() to support multiple space-seperated arguments. > But, when the keyword "all" is included in space-seperated arguments, > it will be treaded as 's name. This patch fixes it. > > Signed-off-by: QI Fuli Looks good, Reviewed-by: Dan Williams ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH v3 1/3] resource: Use list_head to link sibling resource
Hi Baoquan, I love your patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v4.17-rc2 next-20180424] [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/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180419-223752 config: microblaze-mmu_defconfig (attached as .config) compiler: microblaze-linux-gcc (GCC) 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=microblaze All errors (new ones prefixed by >>): arch/microblaze/pci/pci-common.c: In function 'pci_process_bridge_OF_ranges': >> arch/microblaze/pci/pci-common.c:536:44: error: incompatible types when >> assigning to type 'struct list_head' from type 'void *' res->parent = res->child = res->sibling = NULL; ^ arch/microblaze/pci/pci-common.c: In function 'reparent_resources': >> arch/microblaze/pci/pci-common.c:631:10: error: assignment from incompatible >> pointer type [-Werror=incompatible-pointer-types] for (pp = &parent->child; (p = *pp) != NULL; pp = &p->sibling) { ^ arch/microblaze/pci/pci-common.c:631:50: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types] for (pp = &parent->child; (p = *pp) != NULL; pp = &p->sibling) { ^ >> arch/microblaze/pci/pci-common.c:644:13: error: incompatible types when >> assigning to type 'struct list_head' from type 'struct resource *' res->child = *firstpp; ^ arch/microblaze/pci/pci-common.c:645:15: error: incompatible types when assigning to type 'struct list_head' from type 'struct resource *' res->sibling = *pp; ^ >> arch/microblaze/pci/pci-common.c:648:9: error: incompatible types when >> assigning to type 'struct resource *' from type 'struct list_head' for (p = res->child; p != NULL; p = p->sibling) { ^ arch/microblaze/pci/pci-common.c:648:36: error: incompatible types when assigning to type 'struct resource *' from type 'struct list_head' for (p = res->child; p != NULL; p = p->sibling) { ^ cc1: some warnings being treated as errors vim +536 arch/microblaze/pci/pci-common.c d3afa58c Michal Simek2010-01-18 387 d3afa58c Michal Simek2010-01-18 388 /** d3afa58c Michal Simek2010-01-18 389 * pci_process_bridge_OF_ranges - Parse PCI bridge resources from device tree d3afa58c Michal Simek2010-01-18 390 * @hose: newly allocated pci_controller to be setup d3afa58c Michal Simek2010-01-18 391 * @dev: device node of the host bridge d3afa58c Michal Simek2010-01-18 392 * @primary: set if primary bus (32 bits only, soon to be deprecated) d3afa58c Michal Simek2010-01-18 393 * d3afa58c Michal Simek2010-01-18 394 * This function will parse the "ranges" property of a PCI host bridge device d3afa58c Michal Simek2010-01-18 395 * node and setup the resource mapping of a pci controller based on its d3afa58c Michal Simek2010-01-18 396 * content. d3afa58c Michal Simek2010-01-18 397 * d3afa58c Michal Simek2010-01-18 398 * Life would be boring if it wasn't for a few issues that we have to deal d3afa58c Michal Simek2010-01-18 399 * with here: d3afa58c Michal Simek2010-01-18 400 * d3afa58c Michal Simek2010-01-18 401 * - We can only cope with one IO space range and up to 3 Memory space d3afa58c Michal Simek2010-01-18 402 * ranges. However, some machines (thanks Apple !) tend to split their d3afa58c Michal Simek2010-01-18 403 * space into lots of small contiguous ranges. So we have to coalesce. d3afa58c Michal Simek2010-01-18 404 * d3afa58c Michal Simek2010-01-18 405 * - We can only cope with all memory ranges having the same offset d3afa58c Michal Simek2010-01-18 406 * between CPU addresses and PCI addresses. Unfortunately, some bridges d3afa58c Michal Simek2010-01-18 407 * are setup for a large 1:1 mapping along with a small "window" which d3afa58c Michal Simek2010-01-18 408 * maps PCI address 0 to some arbitrary high address of the CPU space in d3afa58c Michal Simek2010-01-18 409 * order to give access to the ISA memory hole. d3afa58c Michal Simek2010-01-18 410 * The way out of here that I've chosen for now is to always set the d3afa58c Michal Simek2010-01-18 411 * offset based on the first resource found, then override it if we d3afa58c Michal Simek2010-01-18 412 * have
Message could not be delivered
The original message was received at Thu, 26 Apr 2018 11:06:12 +0800 from lists.01.org [222.187.51.196] - The following addresses had permanent fatal errors - ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH v3 1/3] resource: Use list_head to link sibling resource
Hi Baoquan, I love your patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v4.17-rc2 next-20180424] [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/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180419-223752 config: xtensa-common_defconfig (attached as .config) compiler: xtensa-linux-gcc (GCC) 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=xtensa All errors (new ones prefixed by >>): In file included from arch/xtensa/lib/pci-auto.c:22:0: arch/xtensa/include/asm/pci-bridge.h: In function 'pcibios_init_resource': >> arch/xtensa/include/asm/pci-bridge.h:74:15: error: incompatible types when >> assigning to type 'struct list_head' from type 'void *' res->sibling = NULL; ^ arch/xtensa/include/asm/pci-bridge.h:75:13: error: incompatible types when assigning to type 'struct list_head' from type 'void *' res->child = NULL; ^ vim +74 arch/xtensa/include/asm/pci-bridge.h 9a8fd558 include/asm-xtensa/pci-bridge.h Chris Zankel 2005-06-23 65 9a8fd558 include/asm-xtensa/pci-bridge.h Chris Zankel 2005-06-23 66 static inline void pcibios_init_resource(struct resource *res, 9a8fd558 include/asm-xtensa/pci-bridge.h Chris Zankel 2005-06-23 67 unsigned long start, unsigned long end, int flags, char *name) 9a8fd558 include/asm-xtensa/pci-bridge.h Chris Zankel 2005-06-23 68 { 9a8fd558 include/asm-xtensa/pci-bridge.h Chris Zankel 2005-06-23 69 res->start = start; 9a8fd558 include/asm-xtensa/pci-bridge.h Chris Zankel 2005-06-23 70 res->end = end; 9a8fd558 include/asm-xtensa/pci-bridge.h Chris Zankel 2005-06-23 71 res->flags = flags; 9a8fd558 include/asm-xtensa/pci-bridge.h Chris Zankel 2005-06-23 72 res->name = name; 9a8fd558 include/asm-xtensa/pci-bridge.h Chris Zankel 2005-06-23 73 res->parent = NULL; 9a8fd558 include/asm-xtensa/pci-bridge.h Chris Zankel 2005-06-23 @74 res->sibling = NULL; 9a8fd558 include/asm-xtensa/pci-bridge.h Chris Zankel 2005-06-23 75 res->child = NULL; 9a8fd558 include/asm-xtensa/pci-bridge.h Chris Zankel 2005-06-23 76 } 9a8fd558 include/asm-xtensa/pci-bridge.h Chris Zankel 2005-06-23 77 :: The code at line 74 was first introduced by commit :: 9a8fd5589902153a134111ed7a40f9cca1f83254 [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 :: TO: Chris Zankel :: CC: Linus Torvalds --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
转发:仓管人员掌握物料管理的技巧--linux-nvdimm
附 件 内 容 请 您 查 阅 ___ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm