All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2] hw/arm/virt: KVM: Enable PAuth when supported by the host
From: Richard Henderson @ 2022-01-05 21:36 UTC (permalink / raw)
  To: Marc Zyngier, qemu-devel
  Cc: kvmarm, kvm, kernel-team, Eric Auger, Andrew Jones, Peter Maydell
In-Reply-To: <20220103180507.2190429-1-maz@kernel.org>

On 1/3/22 10:05 AM, Marc Zyngier wrote:
> -        /*
> -         * KVM does not support modifications to this feature.
> -         * We have not registered the cpu properties when KVM
> -         * is in use, so the user will not be able to set them.
> -         */
> -        if (!kvm_enabled()) {
> -            arm_cpu_pauth_finalize(cpu, &local_err);
> -            if (local_err != NULL) {
> +	arm_cpu_pauth_finalize(cpu, &local_err);
> +	if (local_err != NULL) {
>                   error_propagate(errp, local_err);
>                   return;
> -            }
> -        }
> +	}

Looks like the indentation is off?

> +static bool kvm_arm_pauth_supported(void)
> +{
> +    return (kvm_check_extension(kvm_state, KVM_CAP_ARM_PTRAUTH_ADDRESS) &&
> +            kvm_check_extension(kvm_state, KVM_CAP_ARM_PTRAUTH_GENERIC));
> +}

Do we really need to have them both set to play the game?  Given that the only thing that 
happens is that we disable whatever host support exists, can we have "pauth enabled" mean 
whatever subset the host has?


> @@ -521,6 +527,17 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
>        */
>       struct kvm_vcpu_init init = { .target = -1, };
>   
> +    /*
> +     * Ask for Pointer Authentication if supported. We can't play the
> +     * SVE trick of synthetising the ID reg as KVM won't tell us

synthesizing

> +     * whether we have the architected or IMPDEF version of PAuth, so
> +     * we have to use the actual ID regs.
> +     */
> +    if (kvm_arm_pauth_supported()) {
> +        init.features[0] |= (1 << KVM_ARM_VCPU_PTRAUTH_ADDRESS |
> +			     1 << KVM_ARM_VCPU_PTRAUTH_GENERIC);

Align the two 1's.

Otherwise, it looks good.


r~

^ permalink raw reply

* [PATCH v2 11/18] pnv_phb4.c: introduce pnv_phb4_set_stack_phb_props()
From: Daniel Henrique Barboza @ 2022-01-05 21:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: danielhb413, qemu-ppc, clg, david
In-Reply-To: <20220105212338.49899-1-danielhb413@gmail.com>

We want to be able to support user creatable pnv-phb4 objects to allow
users to instantiate a powernv9 machine similar to what it is done with
powernv8.

The main difference is that pnv-phb3 devs are attached directly to the
system bus and can be created in the command line. PCI devices such as
root-ports can be explictly connected to them. This allows users to
create the phbs, assign a bus name if desired, then connect devices onto
them.

pnv-phb4 devices on the other hand are created by adding PCI Express
Controllers (PEC) that will create a certain amount of pnv-phb4 buses
depending on the PEC index used. Index 0 will create 1 phb, index 1
creates 2 phbs, index 2 creates 3 phbs. Creating all PECs from the same
chip will create 6 PHBs. This doesn't users to rename the buses, like it
is done with pnv-phb3, because there's no user control over how the
pnv-phb4 are being created - aside from the amount of phbs and in which
chips they'll reside.

This implicit relationship between PEC devices and available buses can
be tolerable for users that knows how the hardware works, but it's
annoying for Libvirt to deal with. Since there's no explicit
relationship, in the command line, between the created buses and the PCI
devices that will connect to them, the domain XML needs to make a lot of
extra assumptions regarding the relationship between regular PCI devices
and the existing PECs.

The first step to allow for user creatable pnv-phb4 devices is to
decouple the pvn-phb logic from the pnv-phb4-pec code. This patch adds a
helper called pnv_phb4_set_stack_phb_props() to remove the code from
pnv_phb4_pec.c that initiates the object properties of pnv-phb4 devices.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
 hw/pci-host/pnv_phb4.c         | 25 +++++++++++++++++++++++++
 hw/pci-host/pnv_phb4_pec.c     | 12 +-----------
 include/hw/pci-host/pnv_phb4.h |  1 +
 3 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index 83dedc878a..6c1a33bc66 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -1158,6 +1158,31 @@ static AddressSpace *pnv_phb4_dma_iommu(PCIBus *bus, void *opaque, int devfn)
     return &ds->dma_as;
 }
 
+/*
+ * Set the object properties of a phb in relation with its stack.
+ *
+ * Note: stack->pec must not be NULL.
+ */
+void pnv_phb4_set_stack_phb_props(PnvPhb4PecStack *stack,
+                                  PnvPHB4 *phb)
+{
+    PnvPhb4PecState *pec = stack->pec;
+    PnvPhb4PecClass *pecc = PNV_PHB4_PEC_GET_CLASS(pec);
+    char name[64];
+
+    snprintf(name, sizeof(name), "xscom-pec-%d.%d-pci-stack-%d-phb",
+             pec->chip_id, pec->index, stack->stack_no);
+    pnv_xscom_region_init(&stack->phb_regs_mr, OBJECT(phb),
+                          &pnv_phb4_xscom_ops, phb, name, 0x40);
+
+    object_property_set_int(OBJECT(phb), "chip-id", pec->chip_id,
+                            &error_fatal);
+    object_property_set_int(OBJECT(phb), "version", pecc->version,
+                            &error_fatal);
+    object_property_set_link(OBJECT(phb), "stack", OBJECT(stack),
+                             &error_abort);
+}
+
 static void pnv_phb4_instance_init(Object *obj)
 {
     PnvPHB4 *phb = PNV_PHB4(obj);
diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c
index f3e4fa0c82..057d4b07fb 100644
--- a/hw/pci-host/pnv_phb4_pec.c
+++ b/hw/pci-host/pnv_phb4_pec.c
@@ -577,17 +577,7 @@ static void pnv_pec_stk_realize(DeviceState *dev, Error **errp)
                           PHB4_PEC_PCI_STK_REGS_COUNT);
 
     /* PHB pass-through */
-    snprintf(name, sizeof(name), "xscom-pec-%d.%d-pci-stack-%d-phb",
-             pec->chip_id, pec->index, stack->stack_no);
-    pnv_xscom_region_init(&stack->phb_regs_mr, OBJECT(&stack->phb),
-                          &pnv_phb4_xscom_ops, &stack->phb, name, 0x40);
-
-    object_property_set_int(OBJECT(&stack->phb), "chip-id", pec->chip_id,
-                            &error_fatal);
-    object_property_set_int(OBJECT(&stack->phb), "version", pecc->version,
-                            &error_fatal);
-    object_property_set_link(OBJECT(&stack->phb), "stack", OBJECT(stack),
-                             &error_abort);
+    pnv_phb4_set_stack_phb_props(stack, &stack->phb);
     if (!sysbus_realize(SYS_BUS_DEVICE(&stack->phb), errp)) {
         return;
     }
diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h
index ea63df9676..7f5b9cc0ac 100644
--- a/include/hw/pci-host/pnv_phb4.h
+++ b/include/hw/pci-host/pnv_phb4.h
@@ -131,6 +131,7 @@ struct PnvPHB4 {
 
 void pnv_phb4_pic_print_info(PnvPHB4 *phb, Monitor *mon);
 void pnv_phb4_update_regions(PnvPhb4PecStack *stack);
+void pnv_phb4_set_stack_phb_props(PnvPhb4PecStack *stack, PnvPHB4 *phb);
 extern const MemoryRegionOps pnv_phb4_xscom_ops;
 
 /*
-- 
2.33.1



^ permalink raw reply related

* [GIT PULL] arm64: dts: socfpga: dts updates for v5.17, part 2
From: Dinh Nguyen @ 2022-01-05 21:36 UTC (permalink / raw)
  To: arm, soc; +Cc: dinguyen

The following changes since commit 8dce88fe80a858f34bb5b46470218fe478d251ee:

  arm64: dts: Update NAND MTD partition for Agilex and Stratix 10 (2021-12-01 08:07:41 -0600)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux.git tags/socfpga_dts_update_for_v5.17_part2

for you to fetch changes up to 0020e9e1f8d3348dd5c9a37612b1089c1a47553d:

  arm64: dts: agilex: align mmc node names with dtschema (2021-12-29 04:57:47 -0600)

----------------------------------------------------------------
SoCFPGA dts updates for v5.17, part 2
- Cleanup of Altera/Intel ARMv7 and ARMv8 DTS and bindings

----------------------------------------------------------------
Krzysztof Kozlowski (17):
      dt-bindings: altera: document existing Cyclone 5 board compatibles
      dt-bindings: altera: document Arria 5 based board compatibles
      dt-bindings: altera: document Arria 10 based board compatibles
      dt-bindings: altera: document VT compatibles
      dt-bindings: altera: document Stratix 10 based board compatibles
      dt-bindings: intel: document Agilex based board compatibles
      dt-bindings: clock: intel,stratix10: convert to dtschema
      ARM: dts: arria5: add board compatible for SoCFPGA DK
      ARM: dts: arria10: add board compatible for Mercury AA1
      ARM: dts: arria10: add board compatible for SoCFPGA DK
      arm64: dts: stratix10: add board compatible for SoCFPGA DK
      arm64: dts: stratix10: move ARM timer out of SoC node
      arm64: dts: stratix10: align mmc node names with dtschema
      arm64: dts: stratix10: align regulator node names with dtschema
      arm64: dts: agilex: add board compatible for SoCFPGA DK
      arm64: dts: agilex: add board compatible for N5X DK
      arm64: dts: agilex: align mmc node names with dtschema

 Documentation/devicetree/bindings/arm/altera.yaml  | 46 +++++++++++++++++++---
 .../devicetree/bindings/arm/intel,socfpga.yaml     | 26 ++++++++++++
 .../devicetree/bindings/clock/intc_stratix10.txt   | 20 ----------
 .../devicetree/bindings/clock/intel,stratix10.yaml | 35 ++++++++++++++++
 arch/arm/boot/dts/socfpga_arria10_mercury_aa1.dts  |  2 +-
 arch/arm/boot/dts/socfpga_arria10_socdk.dtsi       |  2 +-
 arch/arm/boot/dts/socfpga_arria5_socdk.dts         |  2 +-
 arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi  | 21 +++++-----
 .../boot/dts/altera/socfpga_stratix10_socdk.dts    |  3 +-
 .../dts/altera/socfpga_stratix10_socdk_nand.dts    |  3 +-
 arch/arm64/boot/dts/intel/socfpga_agilex.dtsi      |  2 +-
 arch/arm64/boot/dts/intel/socfpga_agilex_socdk.dts |  1 +
 .../boot/dts/intel/socfpga_agilex_socdk_nand.dts   |  1 +
 arch/arm64/boot/dts/intel/socfpga_n5x_socdk.dts    |  1 +
 14 files changed, 123 insertions(+), 42 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/intel,socfpga.yaml
 delete mode 100644 Documentation/devicetree/bindings/clock/intc_stratix10.txt
 create mode 100644 Documentation/devicetree/bindings/clock/intel,stratix10.yaml

^ permalink raw reply

* [PATCH v2 06/18] ppc/pnv: Introduce support for user created PHB3 devices
From: Daniel Henrique Barboza @ 2022-01-05 21:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: danielhb413, qemu-ppc, clg, david
In-Reply-To: <20220105212338.49899-1-danielhb413@gmail.com>

From: Cédric Le Goater <clg@kaod.org>

PHB3 devices and PCI devices can now be added to the powernv8 machine
using :

  -device pnv-phb3,chip-id=0,index=1 \
  -device nec-usb-xhci,bus=pci.1,addr=0x0

The 'index' property identifies the PHB3 in the chip. In case of user
created devices, a lookup on 'chip-id' is required to assign the
owning chip.

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/pci-host/pnv_phb3.c | 11 ++++++++++-
 hw/ppc/pnv.c           | 23 ++++++++++++++++++-----
 include/hw/ppc/pnv.h   |  2 ++
 3 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c
index fdc8d0b437..1ebe43df5d 100644
--- a/hw/pci-host/pnv_phb3.c
+++ b/hw/pci-host/pnv_phb3.c
@@ -991,6 +991,15 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp)
     PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
     int i;
 
+    /* User created devices */
+    if (!phb->chip) {
+        phb->chip = pnv_get_chip(pnv, phb->chip_id);
+        if (!phb->chip) {
+            error_setg(errp, "invalid chip id: %d", phb->chip_id);
+            return;
+        }
+    }
+
     if (phb->phb_id >= PNV_CHIP_GET_CLASS(phb->chip)->num_phbs) {
         error_setg(errp, "invalid PHB index: %d", phb->phb_id);
         return;
@@ -1104,7 +1113,7 @@ static void pnv_phb3_class_init(ObjectClass *klass, void *data)
     dc->realize = pnv_phb3_realize;
     device_class_set_props(dc, pnv_phb3_properties);
     set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
-    dc->user_creatable = false;
+    dc->user_creatable = true;
 }
 
 static const TypeInfo pnv_phb3_type_info = {
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 3a263f631a..ad02d56aa7 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1117,14 +1117,14 @@ static void pnv_chip_power8_instance_init(Object *obj)
 
     object_initialize_child(obj, "homer", &chip8->homer, TYPE_PNV8_HOMER);
 
-    for (i = 0; i < pcc->num_phbs; i++) {
+    if (defaults_enabled()) {
+        chip->num_phbs = pcc->num_phbs;
+    }
+
+    for (i = 0; i < chip->num_phbs; i++) {
         object_initialize_child(obj, "phb[*]", &chip8->phbs[i], TYPE_PNV_PHB3);
     }
 
-    /*
-     * Number of PHBs is the chip default
-     */
-    chip->num_phbs = pcc->num_phbs;
 }
 
 static void pnv_chip_icp_realize(Pnv8Chip *chip8, Error **errp)
@@ -1814,6 +1814,19 @@ static ICSState *pnv_ics_get(XICSFabric *xi, int irq)
     return NULL;
 }
 
+PnvChip *pnv_get_chip(PnvMachineState *pnv, uint32_t chip_id)
+{
+    int i;
+
+    for (i = 0; i < pnv->num_chips; i++) {
+        PnvChip *chip = pnv->chips[i];
+        if (chip->chip_id == chip_id) {
+            return chip;
+        }
+    }
+    return NULL;
+}
+
 static int pnv_ics_resend_child(Object *child, void *opaque)
 {
     PnvPHB3 *phb3 = (PnvPHB3 *) object_dynamic_cast(child, TYPE_PNV_PHB3);
diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h
index c726288e5e..64bab7112b 100644
--- a/include/hw/ppc/pnv.h
+++ b/include/hw/ppc/pnv.h
@@ -218,6 +218,8 @@ struct PnvMachineState {
     hwaddr       fw_load_addr;
 };
 
+PnvChip *pnv_get_chip(PnvMachineState *pnv, uint32_t chip_id);
+
 #define PNV_FDT_ADDR          0x01000000
 #define PNV_TIMEBASE_FREQ     512000000ULL
 
-- 
2.33.1



^ permalink raw reply related

* Re: [RFC PATCH 00/10] KVM: selftests: Add support for test-selectable ucall implementations
From: Michael Roth @ 2022-01-05 21:35 UTC (permalink / raw)
  To: Sean Christopherson
  Cc: linux-kselftest, kvm, linux-kernel, x86, Nathan Tempelman,
	Marc Orr, Steve Rutherford, Mingwei Zhang, Brijesh Singh,
	Tom Lendacky, Varad Gautam, Shuah Khan, Vitaly Kuznetsov,
	David Woodhouse, Ricardo Koller, Jim Mattson, Joerg Roedel,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, H . Peter Anvin,
	Christian Borntraeger, Janosch Frank, David Hildenbrand,
	Claudio Imbrenda, Marc Zyngier, James Morse, Alexandru Elisei,
	Suzuki K Poulose, kvmarm
In-Reply-To: <YdX0SRoBXReggrVA@google.com>

On Wed, Jan 05, 2022 at 07:40:57PM +0000, Sean Christopherson wrote:
> On Wed, Jan 05, 2022, Michael Roth wrote:
> > On Wed, Jan 05, 2022 at 05:43:21PM +0000, Sean Christopherson wrote:
> > > Because it uses multiple VMs, and my rough sketch only allows for a single VM to
> > > use ucall.  Though I suppose we could simply keep appending to the ucall list for
> > > every VM.  The requirement would then be that all VMs are of the same type, i.e.
> > > utilize the same ucall_ops.
> > 
> > Hmm, maybe I misread your patch. Not supporting multiple VMs was the
> > reason I gave up on having the ucall structs allocated on-demand and
> > went with requiring them to be passed as arguments to ucall().
> > 
> > I thought with your patch you had solved that by having each vm have it's
> > own pool, via vm->ucall_list, and then mapping each pool into each guest
> > separately via:
> > 
> >   ucall_init(vm):
> >     ucall_list = vm->ucall_list
> >     sync_global_to_guest(ucall_list).
> > 
> > then as long as that ucall_init() is done *after* the guest calls
> > kvm_vm_elf_load(), it will end up with a 'ucall_list' global that points
> > to it's own specific vm->ucall_list. Then on the test side it doesn't
> > matter what the 'ucall_list' global is currently set to since you have
> > the GPA and know what vm exited.
> > 
> > Or am I missing something there?
> 
> Ha, that was not at all intented.  But yes, it should work.  I'd rather be lucky
> than good?

:)

> 
> > Although even if that is the case, now that we're proposing doing the
> > ucall_init() inside vm_create(), then we run the risk of a test calling
> > kvm_vm_elf_load() after, which might clobber the guest's copy of
> > ucall_list global if ucall_init() had since been called for another VM.
> > But that could maybe be worked around by having whatever vm_create()
> > variant we use also do the kvm_vm_elf_load() unconditionally as part of
> > creation.
> 
> Will sync_global_to_guest() even work as intended if kvm_vm_elf_load() hasn't
> been called?  If not, then sync_global_{to,from}_guest() should really assert if
> the test hasn't been loaded.

Yah, seems like it would get clobbered by kvm_vm_elf_load() later. And
can't think of any good reason to use sync_global_to_guest() without also
needing kvm_vm_elf_load() at some point, so makes sense to enforce it.

> 
> As for ucall_init(), I think the best approach would be to make kvm_vm_elf_load()
> a static and replace all calls with:
> 
> 	kvm_vm_load_guest(vm);
> 
> where its implementation is:
> 
>   void kvm_vm_load_guest(struct kvm_vm *vm)
>   {
>   	kvm_vm_elf_load(vm, program_invocation_name);
> 
> 	ucall_init(vm);
>   }
> 
> The logic being that if a test creates a VM but never loads any code into the guest,
> e.g. kvm_create_max_vcpus, then it _can't_ make ucalls.

Makes sense. And if different ops are needed for vmgexit()/tdcall() it
could be something like (if based on patches 1-5 of this series, and
extending vm_guest_mode as you suggested earlier):

   void kvm_vm_load_guest(struct kvm_vm *vm)
   {

     kvm_vm_elf_load(vm, program_invocation_name);
  
     if (vm->mode == VM_MODE_SEV)
  	    ucall_init_ops(vm, ucall_ops_pio_vmgexit);
     else (vm->vm_type == VM_MODE_TDX)
  	    ucall_init_ops(vm, ucall_ops_pio_tdcall);
     else
  	    ucall_init_ops(vm, ucall_ops_pio);

Shame we have to update all the kvm_vm_elf_load() call-sites, but
they'd end up potentially breaking things if left as-is anyway.

Were you planning on sending patches for these changes, or should I incorporate
your prototype and take a stab at the other changes as part of v2 of this
series?

^ permalink raw reply

* [ndctl PATCH v3 13/16] ndctl: Drop executable bit for bash-completion script
From: Dan Williams @ 2022-01-05 21:32 UTC (permalink / raw)
  To: vishal.l.verma; +Cc: nvdimm, linux-cxl
In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com>

The rpm build process warns:

*** WARNING: ./usr/share/bash-completion/completions/ndctl is executable but has no shebang, removing executable bit

Clear the unnecessary executable bit since completion helpers are sourced,
not executed.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 contrib/ndctl |    0 
 1 file changed, 0 insertions(+), 0 deletions(-)
 mode change 100755 => 100644 contrib/ndctl

diff --git a/contrib/ndctl b/contrib/ndctl
old mode 100755
new mode 100644


^ permalink raw reply

* Re: [PATCH v2] drm/msm/dp: populate connector of struct dp_panel
From: Stephen Boyd @ 2022-01-05 21:34 UTC (permalink / raw)
  To: Kuogee Hsieh, agross, airlied, bjorn.andersson, daniel,
	dmitry.baryshkov, robdclark, sean, vkoul
  Cc: quic_abhinavk, aravindh, quic_sbillaka, freedreno, dri-devel,
	linux-arm-msm, linux-kernel
In-Reply-To: <1640805422-21904-1-git-send-email-quic_khsieh@quicinc.com>

Quoting Kuogee Hsieh (2021-12-29 11:17:02)
> There is kernel crashed due to unable to handle kernel NULL
> pointer dereference of dp_panel->connector while running DP link
> layer compliance test case 4.2.2.6 (EDID Corruption Detection).

Can you explain how we get into that situation? Like

"We never assign struct dp_panel::connector, instead the connector is
stored in struct msm_dp::connector. When we run compliance testing test
case 4.2.2.6 dp_panel_handle_sink_request() won't have a valid edid set
in struct dp_panel::edid so we'll try to use the connectors
real_edid_checksum and hit a NULL pointer deref error because the
connector pointer is never assigned."

> This patch fixes this problem by populating connector of dp_panel.
>
> [drm:dp_panel_read_sink_caps] *ERROR* panel edid read failed
> Unable to handle kernel NULL pointer dereference at virtual address 00000000000006e1
> Mem abort info:
>   ESR = 0x96000006
>   EC = 0x25: DABT (current EL), IL = 32 bits
>   SET = 0, FnV = 0
>   EA = 0, S1PTW = 0
> Data abort info:
>   ISV = 0, ISS = 0x00000006
>   CM = 0, WnR = 0
> user pgtable: 4k pages, 39-bit VAs, pgdp=0000000115f25000
> [00000000000006e1] pgd=00000001174fe003, p4d=00000001174fe003, pud=00000001174fe003, pmd=0000000000000000
> Internal error: Oops: 96000006 [#1] PREEMPT SMP

This sort of stuff isn't really useful because it takes quite a few
lines to say "We hit a NULL pointer deref" which was already stated. I'd
rather have a clear description of what goes wrong and how setting the
pointer in msm_dp_modeset_init() fixes it.

> {...]
>
> Changes in V2:
> -- populate panel connector at msm_dp_modeset_init() instead of at dp_panel_read_sink_caps()
>
> Fixes: 7948fe12d47 ("drm/msm/dp: return correct edid checksum after corrupted edid checksum read")
> Signee-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> ---
>  drivers/gpu/drm/msm/dp/dp_display.c | 25 +++++++++++++++----------
>  1 file changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> index 3449d3f..c282bbf 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -1495,36 +1495,41 @@ void msm_dp_debugfs_init(struct msm_dp *dp_display, struct drm_minor *minor)
>         }
>  }
>
> -int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev,
> +int msm_dp_modeset_init(struct msm_dp *dp, struct drm_device *dev,
>                         struct drm_encoder *encoder)
>  {
>         struct msm_drm_private *priv;
> +       struct dp_display_private *dp_display;
>         int ret;
>
> -       if (WARN_ON(!encoder) || WARN_ON(!dp_display) || WARN_ON(!dev))
> +       if (WARN_ON(!encoder) || WARN_ON(!dp) || WARN_ON(!dev))
>                 return -EINVAL;
>
>         priv = dev->dev_private;
> -       dp_display->drm_dev = dev;
> +       dp->drm_dev = dev;
> +
> +       dp_display = container_of(dp, struct dp_display_private, dp_display);
>
> -       ret = dp_display_request_irq(dp_display);
> +       ret = dp_display_request_irq(dp);
>         if (ret) {
>                 DRM_ERROR("request_irq failed, ret=%d\n", ret);
>                 return ret;
>         }
>
> -       dp_display->encoder = encoder;
> +       dp->encoder = encoder;
>
> -       dp_display->connector = dp_drm_connector_init(dp_display);
> -       if (IS_ERR(dp_display->connector)) {
> -               ret = PTR_ERR(dp_display->connector);
> +       dp->connector = dp_drm_connector_init(dp);
> +       if (IS_ERR(dp->connector)) {
> +               ret = PTR_ERR(dp->connector);
>                 DRM_DEV_ERROR(dev->dev,
>                         "failed to create dp connector: %d\n", ret);
> -               dp_display->connector = NULL;
> +               dp->connector = NULL;
>                 return ret;
>         }
>
> -       priv->connectors[priv->num_connectors++] = dp_display->connector;
> +       dp_display->panel->connector = dp->connector;

This is the one line that matters I think? Can we reach the connector
for the dp device without going through the panel in
dp_panel_handle_sink_request()? That would reduce the number of struct
elements if possible.

> +
> +       priv->connectors[priv->num_connectors++] = dp->connector;

Can we not rename all the local variables in this patch and do it later
or never? Reading this patch takes a long time because we have to make
sure nothing has actually changed with the rename of 'dp_display' to
'dp'.

>         return 0;
>  }
>
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>

^ permalink raw reply

* [PATCH v2 09/18] ppc/pnv: Move num_phbs under Pnv8Chip
From: Daniel Henrique Barboza @ 2022-01-05 21:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: danielhb413, qemu-ppc, clg, david
In-Reply-To: <20220105212338.49899-1-danielhb413@gmail.com>

From: Cédric Le Goater <clg@kaod.org>

It is not used elsewhere so that's where it belongs.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/ppc/pnv.c         | 7 +++----
 include/hw/ppc/pnv.h | 4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 8dc6382357..fe7e67e73a 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1099,7 +1099,6 @@ static void pnv_chip_power10_intc_print_info(PnvChip *chip, PowerPCCPU *cpu,
 
 static void pnv_chip_power8_instance_init(Object *obj)
 {
-    PnvChip *chip = PNV_CHIP(obj);
     Pnv8Chip *chip8 = PNV8_CHIP(obj);
     PnvChipClass *pcc = PNV_CHIP_GET_CLASS(obj);
     int i;
@@ -1118,10 +1117,10 @@ static void pnv_chip_power8_instance_init(Object *obj)
     object_initialize_child(obj, "homer", &chip8->homer, TYPE_PNV8_HOMER);
 
     if (defaults_enabled()) {
-        chip->num_phbs = pcc->num_phbs;
+        chip8->num_phbs = pcc->num_phbs;
     }
 
-    for (i = 0; i < chip->num_phbs; i++) {
+    for (i = 0; i < chip8->num_phbs; i++) {
         object_initialize_child(obj, "phb[*]", &chip8->phbs[i], TYPE_PNV_PHB3);
     }
 
@@ -1247,7 +1246,7 @@ static void pnv_chip_power8_realize(DeviceState *dev, Error **errp)
                                 &chip8->homer.regs);
 
     /* PHB3 controllers */
-    for (i = 0; i < chip->num_phbs; i++) {
+    for (i = 0; i < chip8->num_phbs; i++) {
         PnvPHB3 *phb = &chip8->phbs[i];
 
         object_property_set_int(OBJECT(phb), "index", i, &error_fatal);
diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h
index f4219da7c5..0e9e16544f 100644
--- a/include/hw/ppc/pnv.h
+++ b/include/hw/ppc/pnv.h
@@ -52,7 +52,6 @@ struct PnvChip {
     uint64_t     cores_mask;
     PnvCore      **cores;
 
-    uint32_t     num_phbs;
     uint32_t     num_pecs;
 
     MemoryRegion xscom_mmio;
@@ -82,6 +81,7 @@ struct Pnv8Chip {
 
 #define PNV8_CHIP_PHB3_MAX 4
     PnvPHB3      phbs[PNV8_CHIP_PHB3_MAX];
+    uint32_t     num_phbs;
 
     XICSFabric    *xics;
 };
@@ -136,8 +136,8 @@ struct PnvChipClass {
     /*< public >*/
     uint64_t     chip_cfam_id;
     uint64_t     cores_mask;
-    uint32_t     num_phbs;
     uint32_t     num_pecs;
+    uint32_t     num_phbs;
 
     DeviceRealize parent_realize;
 
-- 
2.33.1



^ permalink raw reply related

* [ndctl PATCH v3 15/16] build: Add meson rpmbuild support
From: Dan Williams @ 2022-01-05 21:32 UTC (permalink / raw)
  To: vishal.l.verma; +Cc: nvdimm, linux-cxl
In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com>

Beyond being a prerequisite for removing autotools support, this capability
served as validation that the meson conversion generated all the same files
as autotools and installed them to the same expected locations.

The procedure to use the rpmbuild.sh script is:

    meson setup build
    meson compile -C build rhel/ndctl.spec
    ./rpmbuild.sh build/rhel/ndctl.spec

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 .gitignore       |    2 +-
 Makefile.am      |    2 ++
 meson.build      |    6 ++++++
 ndctl.spec.in    |   23 +++++++++++++++++++++++
 rhel/meson.build |   23 +++++++++++++++++++++++
 rpmbuild.sh      |    5 ++++-
 sles/meson.build |   36 ++++++++++++++++++++++++++++++++++++
 7 files changed, 95 insertions(+), 2 deletions(-)
 create mode 100644 rhel/meson.build
 create mode 100644 sles/meson.build

diff --git a/.gitignore b/.gitignore
index 91c5e37b7fef..df8245dc10d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,7 +35,7 @@ daxctl/lib/libdaxctl.pc
 ndctl/config.h
 ndctl/lib/libndctl.pc
 ndctl/ndctl
-rhel/
+rhel/ndctl.spec
 sles/ndctl.spec
 version.m4
 *.swp
diff --git a/Makefile.am b/Makefile.am
index daea39f5d41e..b78059b0b364 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,6 +22,7 @@ noinst_SCRIPTS = rhel/ndctl.spec sles/ndctl.spec
 CLEANFILES += $(noinst_SCRIPTS)
 
 do_rhel_subst = sed -e 's,VERSION,$(VERSION),g' \
+            -e 's,MESON,0,g' \
             -e 's,DAX_DNAME,daxctl-devel,g' \
             -e 's,CXL_DNAME,cxl-devel,g' \
             -e 's,DNAME,ndctl-devel,g' \
@@ -31,6 +32,7 @@ do_rhel_subst = sed -e 's,VERSION,$(VERSION),g' \
 	    -e 's,LNAME,ndctl-libs,g'
 
 do_sles_subst = sed -e 's,VERSION,$(VERSION),g' \
+            -e 's,MESON,0,g' \
             -e 's,DAX_DNAME,libdaxctl-devel,g' \
             -e 's,CXL_DNAME,libcxl-devel,g' \
             -e 's,DNAME,libndctl-devel,g' \
diff --git a/meson.build b/meson.build
index 272ac642c193..b22fb2e57f6b 100644
--- a/meson.build
+++ b/meson.build
@@ -278,3 +278,9 @@ if get_option('docs').enabled()
 endif
 subdir('test')
 subdir('contrib')
+
+# only support spec file generation from git builds
+if version_tag == ''
+  subdir('rhel')
+  subdir('sles')
+endif
diff --git a/ndctl.spec.in b/ndctl.spec.in
index cb911194a2cb..9447267839d2 100644
--- a/ndctl.spec.in
+++ b/ndctl.spec.in
@@ -6,14 +6,20 @@ License:	GPLv2
 Url:		https://github.com/pmem/ndctl
 Source0:	https://github.com/pmem/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
 
+%define with_meson MESON
 Requires:	LNAME%{?_isa} = %{version}-%{release}
 Requires:	DAX_LNAME%{?_isa} = %{version}-%{release}
 Requires:	CXL_LNAME%{?_isa} = %{version}-%{release}
 BuildRequires:	autoconf
 %if 0%{?rhel} < 9
 BuildRequires:	asciidoc
+%if !%{with_meson}
 %define asciidoc --disable-asciidoctor
+%endif
 %else
+%if %{with_meson}
+%define asciidoctor -Dasciidoctor=enabled
+%endif
 BuildRequires:	rubygem-asciidoctor
 %endif
 BuildRequires:	xmlto
@@ -30,6 +36,10 @@ BuildRequires:	keyutils-libs-devel
 BuildRequires:	systemd-rpm-macros
 BuildRequires:	iniparser-devel
 
+%if %{with_meson}
+BuildRequires:	meson
+%endif
+
 %description
 Utility library for managing the "libnvdimm" subsystem.  The "libnvdimm"
 subsystem defines a kernel device model and control message interface for
@@ -117,17 +127,30 @@ libcxl is a library for enumerating and communicating with CXL devices.
 %setup -q ndctl-%{version}
 
 %build
+%if %{with_meson}
+%meson %{?asciidoctor} -Dversion-tag=%{version}
+%meson_build
+%else
 echo %{version} > version
 ./autogen.sh
 %configure --disable-static --disable-silent-rules %{?asciidoc}
 make %{?_smp_mflags}
+%endif
 
 %install
+%if %{with_meson}
+%meson_install
+%else
 %make_install
 find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
+%endif
 
 %check
+%if %{with_meson}
+%meson_test
+%else
 make check
+%endif
 
 %ldconfig_scriptlets -n LNAME
 
diff --git a/rhel/meson.build b/rhel/meson.build
new file mode 100644
index 000000000000..8672098d84e1
--- /dev/null
+++ b/rhel/meson.build
@@ -0,0 +1,23 @@
+rhel_spec1 = vcs_tag(
+    input : '../ndctl.spec.in',
+    output : 'ndctl.spec.in',
+    command: vcs_tagger,
+    replace_string : 'VERSION',
+)
+
+rhel_spec2 = custom_target('ndctl.spec',
+  command : [
+    'sed', '-e', 's,MESON,1,g',
+	   '-e', 's,DAX_DNAME,daxctl-devel,g',
+	   '-e', 's,CXL_DNAME,cxl-devel,g',
+	   '-e', 's,DNAME,ndctl-devel,g',
+	   '-e', '/^%defattr.*/d',
+	   '-e', 's,DAX_LNAME,daxctl-libs,g',
+	   '-e', 's,CXL_LNAME,cxl-libs,g',
+	   '-e', 's,LNAME,ndctl-libs,g',
+	   '@INPUT@'
+  ],
+  input : rhel_spec1,
+  output : 'ndctl.spec',
+  capture : true,
+)
diff --git a/rpmbuild.sh b/rpmbuild.sh
index fe4154b6be9f..b1f4d9e5c0f3 100755
--- a/rpmbuild.sh
+++ b/rpmbuild.sh
@@ -1,6 +1,9 @@
 #!/bin/bash
+
+spec=${1:-$(dirname $0)/rhel/ndctl.spec)}
+
 pushd $(dirname $0) >/dev/null
 [ ! -d ~/rpmbuild/SOURCES ] && echo "rpmdev tree not found" && exit 1
 ./make-git-snapshot.sh
 popd > /dev/null
-rpmbuild -ba $(dirname $0)/rhel/ndctl.spec
+rpmbuild --nocheck -ba $spec
diff --git a/sles/meson.build b/sles/meson.build
new file mode 100644
index 000000000000..21c72cb4f5ec
--- /dev/null
+++ b/sles/meson.build
@@ -0,0 +1,36 @@
+sles_spec1 = vcs_tag(
+    input : '../ndctl.spec.in',
+    output : 'ndctl.spec.sles.in',
+    command: vcs_tagger,
+    replace_string : 'VERSION',
+)
+
+header = files('header')
+
+sles_spec2 = custom_target('ndctl.spec.in',
+  command : [
+    'cat', header, '@INPUT@',
+  ],
+  input : sles_spec1,
+  output : 'ndctl.spec.in',
+  capture : true,
+)
+
+sles_spec3 = custom_target('ndctl.spec',
+  command : [
+    'sed', '-e', 's,MESON,1,g',
+           '-e', 's,DAX_DNAME,libdaxctl-devel,g',
+           '-e', 's,CXL_DNAME,libcxl-devel,g',
+           '-e', 's,DNAME,libndctl-devel,g',
+           '-e', 's,%license,%doc,g',
+           '-e', 's,\(^License:.*GPL\)v2,\1-2.0,g',
+           '-e', 's,DAX_LNAME,libdaxctl@0@,g'.format(LIBDAXCTL_CURRENT - LIBDAXCTL_AGE),
+           '-e', 's,CXL_LNAME,libcxl@0@,g'.format(LIBCXL_CURRENT - LIBCXL_AGE),
+           '-e', 's,LNAME,libndctl@0@,g'.format(LIBNDCTL_CURRENT - LIBNDCTL_AGE),
+	   '@INPUT@'
+  ],
+
+  input : sles_spec2,
+  output : 'ndctl.spec',
+  capture : true,
+)


^ permalink raw reply related

* [ndctl PATCH v3 14/16] build: Add meson build infrastructure
From: Dan Williams @ 2022-01-05 21:32 UTC (permalink / raw)
  To: vishal.l.verma; +Cc: Vaibhav Jain, nvdimm, linux-cxl
In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com>

Build times improve from 10s of seconds to sub-second builds especially
when ccache gets involved and the only change is a git version bump. Recall
that every time the version changes with autotools it does a reconfigure.
With meson only the objects that depend on the version string are rebuilt.
So the primary motivation is to make the ndctl project more enjoyable to
develop.

Tools, libraries, documentation, and tests all seem to be working. The
remaining work is to redo the rpm build infrastructure, and validate that
installation is working as expected.

Given the long standing momentum on the old build system it is still kept
functional for now. The only compatibility hack when moving from an
autotools build to a meson build is to delete the config.h files generated
by the old system in favor of the unified configuration header build from
the config.h.meson template.

Tested-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 .gitignore                        |    5 +
 Documentation/cxl/lib/meson.build |   79 ++++++++++
 Documentation/cxl/meson.build     |   84 +++++++++++
 Documentation/daxctl/meson.build  |   94 ++++++++++++
 Documentation/ndctl/meson.build   |  124 ++++++++++++++++
 clean_config.sh                   |    2 
 config.h.meson                    |  151 ++++++++++++++++++++
 contrib/meson.build               |   28 ++++
 cxl/lib/meson.build               |   35 +++++
 cxl/meson.build                   |   25 +++
 daxctl/device.c                   |    1 
 daxctl/lib/meson.build            |   44 ++++++
 daxctl/meson.build                |   35 +++++
 meson.build                       |  280 +++++++++++++++++++++++++++++++++++++
 meson_options.txt                 |   25 +++
 ndctl/lib/meson.build             |   48 ++++++
 ndctl/meson.build                 |   82 +++++++++++
 test/meson.build                  |  237 +++++++++++++++++++++++++++++++
 tools/meson-vcs-tag.sh            |   18 ++
 util/meson.build                  |   16 ++
 version.h.in                      |    2 
 21 files changed, 1414 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/cxl/lib/meson.build
 create mode 100644 Documentation/cxl/meson.build
 create mode 100644 Documentation/daxctl/meson.build
 create mode 100644 Documentation/ndctl/meson.build
 create mode 100755 clean_config.sh
 create mode 100644 config.h.meson
 create mode 100644 contrib/meson.build
 create mode 100644 cxl/lib/meson.build
 create mode 100644 cxl/meson.build
 create mode 100644 daxctl/lib/meson.build
 create mode 100644 daxctl/meson.build
 create mode 100644 meson.build
 create mode 100644 meson_options.txt
 create mode 100644 ndctl/lib/meson.build
 create mode 100644 ndctl/meson.build
 create mode 100644 test/meson.build
 create mode 100755 tools/meson-vcs-tag.sh
 create mode 100644 util/meson.build
 create mode 100644 version.h.in

diff --git a/.gitignore b/.gitignore
index 4ab393e71a89..91c5e37b7fef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,7 +9,9 @@ Makefile.in
 /aclocal.m4
 /autom4te.cache
 /build-aux
-/config.*
+/config.h
+/config.log
+/config.status
 /configure
 /libtool
 /stamp-h1
@@ -24,6 +26,7 @@ Documentation/ndctl/asciidoctor-extensions.rb
 Documentation/cxl/asciidoctor-extensions.rb
 Documentation/cxl/lib/asciidoctor-extensions.rb
 .dirstamp
+build/
 daxctl/config.h
 daxctl/daxctl
 daxctl/lib/libdaxctl.la
diff --git a/Documentation/cxl/lib/meson.build b/Documentation/cxl/lib/meson.build
new file mode 100644
index 000000000000..4b3f59685447
--- /dev/null
+++ b/Documentation/cxl/lib/meson.build
@@ -0,0 +1,79 @@
+if get_option('asciidoctor').enabled()
+  asciidoc_conf = custom_target('asciidoctor-extensions.rb',
+    command : [
+      'sed', '-e', 's,@Utility@,Libcxl,g', '-e', 's,@utility@,cxl,g', '@INPUT@'
+    ],
+    input : '../../asciidoctor-extensions.rb.in',
+    output : 'asciidoctor-extensions.rb',
+    capture : true,
+  )
+else
+  asciidoc_conf = custom_target('asciidoc.conf',
+    command : [
+      'sed', '-e', 's,UTILITY,libcxl,g',
+    ],
+    input : '../../asciidoc.conf.in',
+    output : 'asciidoc.conf',
+    capture : true,
+  )
+endif
+
+filedeps = [
+        '../../copyright.txt',
+]
+
+libcxl_manpages = [
+  'libcxl.txt',
+  'cxl_new.txt',
+]
+
+foreach man : libcxl_manpages
+  name = man.split('.')[0]
+  output = name + '.3'
+  output_xml = name + '.xml'
+  if get_option('asciidoctor').enabled()
+    custom_target(name,
+      command : [
+        asciidoc,
+        '-b', 'manpage', '-d', 'manpage', '-acompat-mode', '-I', '@OUTDIR@',
+        '-rasciidoctor-extensions', '-amansource=libcxl',
+        '-amanmanual=libcxl Manual',
+        '-andctl_version=@0@'.format(meson.project_version()),
+        '-o', '@OUTPUT@', '@INPUT@'
+      ],
+      input : man,
+      output : output,
+      depend_files : filedeps,
+      depends : asciidoc_conf,
+      install : get_option('docs').enabled(),
+      install_dir : join_paths(get_option('mandir'), 'man3'),
+    )
+  else
+    xml = custom_target(output_xml,
+      command : [
+        asciidoc,
+	'-b', 'docbook', '-d', 'manpage', '-f', asciidoc_conf, '--unsafe',
+	'-andctl_version=@0@'.format(meson.project_version()),
+	'-o', '@OUTPUT@', '@INPUT@',
+      ],
+      input : man,
+      output : output_xml,
+      depend_files : filedeps,
+      depends : asciidoc_conf,
+    )
+
+    xsl = files('../../manpage-normal.xsl')
+
+    custom_target(name,
+      command : [
+        xmlto, '-o', '@OUTDIR@', '-m', xsl, 'man', '@INPUT@'
+      ],
+      depends : xml,
+      depend_files : xsl,
+      input : xml,
+      output : output,
+      install : get_option('docs').enabled(),
+      install_dir : join_paths(get_option('mandir'), 'man3'),
+    )
+  endif
+endforeach
diff --git a/Documentation/cxl/meson.build b/Documentation/cxl/meson.build
new file mode 100644
index 000000000000..64ce13f59012
--- /dev/null
+++ b/Documentation/cxl/meson.build
@@ -0,0 +1,84 @@
+if get_option('asciidoctor').enabled()
+  asciidoc_conf = custom_target('asciidoctor-extensions.rb',
+    command : [
+      'sed', '-e', 's,@Utility@,Cxl,g', '-e', 's,@utility@,cxl,g', '@INPUT@'
+    ],
+    input : '../asciidoctor-extensions.rb.in',
+    output : 'asciidoctor-extensions.rb',
+    capture : true,
+  )
+else
+  asciidoc_conf = custom_target('asciidoc.conf',
+    command : [
+      'sed', '-e', 's,UTILITY,cxl,g',
+    ],
+    input : '../asciidoc.conf.in',
+    output : 'asciidoc.conf',
+    capture : true,
+  )
+endif
+
+filedeps = [
+        '../copyright.txt',
+]
+
+cxl_manpages = [
+  'cxl.txt',
+  'cxl-list.txt',
+  'cxl-read-labels.txt',
+  'cxl-write-labels.txt',
+  'cxl-zero-labels.txt',
+]
+
+foreach man : cxl_manpages
+  name = man.split('.')[0]
+  output = name + '.1'
+  output_xml = name + '.xml'
+  if get_option('asciidoctor').enabled()
+    custom_target(name,
+      command : [
+        asciidoc,
+        '-b', 'manpage', '-d', 'manpage', '-acompat-mode', '-I', '@OUTDIR@',
+        '-rasciidoctor-extensions', '-amansource=cxl',
+        '-amanmanual=cxl Manual',
+        '-andctl_version=@0@'.format(meson.project_version()),
+        '-o', '@OUTPUT@', '@INPUT@'
+      ],
+      input : man,
+      output : output,
+      depend_files : filedeps,
+      depends : asciidoc_conf,
+      install : get_option('docs').enabled(),
+      install_dir : join_paths(get_option('mandir'), 'man1'),
+    )
+  else
+    xml = custom_target(output_xml,
+      command : [
+        asciidoc,
+	'-b', 'docbook', '-d', 'manpage', '-f', asciidoc_conf, '--unsafe',
+	'-andctl_version=@0@'.format(meson.project_version()),
+	'-o', '@OUTPUT@', '@INPUT@',
+      ],
+      input : man,
+      output : output_xml,
+      depend_files : filedeps,
+      depends : asciidoc_conf,
+    )
+
+    xsl = files('../manpage-normal.xsl')
+
+    custom_target(name,
+      command : [
+        xmlto, '-o', '@OUTDIR@', '-m', xsl, 'man', '@INPUT@'
+      ],
+      depends : xml,
+      depend_files : xsl,
+      input : xml,
+      output : output,
+      install : get_option('docs').enabled(),
+      install_dir : join_paths(get_option('mandir'), 'man1'),
+    )
+  endif
+endforeach
+
+subdir('lib')
diff --git a/Documentation/daxctl/meson.build b/Documentation/daxctl/meson.build
new file mode 100644
index 000000000000..7699e69c29be
--- /dev/null
+++ b/Documentation/daxctl/meson.build
@@ -0,0 +1,94 @@
+if get_option('asciidoctor').enabled()
+  asciidoc_conf = custom_target('asciidoctor-extensions.rb',
+    command : [
+      'sed', '-e', 's,@Utility@,Daxctl,g', '-e', 's,@utility@,daxctl,g', '@INPUT@'
+    ],
+    input : '../asciidoctor-extensions.rb.in',
+    output : 'asciidoctor-extensions.rb',
+    capture : true,
+  )
+else
+  asciidoc_conf = custom_target('asciidoc.conf',
+    command : [
+      'sed', '-e', 's,UTILITY,daxctl,g',
+    ],
+    input : '../asciidoc.conf.in',
+    output : 'asciidoc.conf',
+    capture : true,
+  )
+endif
+
+filedeps = [
+	'human-option.txt',
+        '../copyright.txt',
+]
+
+daxctl_manpages = [
+  'daxctl.txt',
+  'daxctl-list.txt',
+  'daxctl-migrate-device-model.txt',
+  'daxctl-reconfigure-device.txt',
+  'daxctl-online-memory.txt',
+  'daxctl-offline-memory.txt',
+  'daxctl-disable-device.txt',
+  'daxctl-enable-device.txt',
+  'daxctl-create-device.txt',
+  'daxctl-destroy-device.txt',
+]
+
+foreach man : daxctl_manpages
+  name = man.split('.')[0]
+  output = name + '.1'
+  output_xml = name + '.xml'
+  if get_option('asciidoctor').enabled()
+    custom_target(name,
+      command : [
+        asciidoc,
+        '-b', 'manpage', '-d', 'manpage', '-acompat-mode', '-I', '@OUTDIR@',
+        '-rasciidoctor-extensions', '-amansource=daxctl',
+        '-amanmanual=daxctl Manual',
+	'-adaxctl_confdir=@0@'.format(daxctlconf_dir),
+	'-adaxctl_conf=@0@'.format(daxctlconf),
+	'-andctl_keysdir=@0@'.format(ndctlkeys_dir),
+        '-andctl_version=@0@'.format(meson.project_version()),
+        '-o', '@OUTPUT@', '@INPUT@'
+      ],
+      input : man,
+      output : output,
+      depend_files : filedeps,
+      depends : asciidoc_conf,
+      install : get_option('docs').enabled(),
+      install_dir : join_paths(get_option('mandir'), 'man1'),
+    )
+  else
+    xml = custom_target(output_xml,
+      command : [
+        asciidoc,
+	'-b', 'docbook', '-d', 'manpage', '-f', asciidoc_conf, '--unsafe',
+	'-adaxctl_confdir=@0@'.format(daxctlconf_dir),
+	'-adaxctl_conf=@0@'.format(daxctlconf),
+	'-andctl_keysdir=@0@'.format(ndctlkeys_dir),
+	'-andctl_version=@0@'.format(meson.project_version()),
+	'-o', '@OUTPUT@', '@INPUT@',
+      ],
+      input : man,
+      output : output_xml,
+      depend_files : filedeps,
+      depends : asciidoc_conf,
+    )
+
+    xsl = files('../manpage-normal.xsl')
+
+    custom_target(name,
+      command : [
+        xmlto, '-o', '@OUTDIR@', '-m', xsl, 'man', '@INPUT@'
+      ],
+      depends : xml,
+      depend_files : xsl,
+      input : xml,
+      output : output,
+      install : get_option('docs').enabled(),
+      install_dir : join_paths(get_option('mandir'), 'man1'),
+    )
+  endif
+endforeach
diff --git a/Documentation/ndctl/meson.build b/Documentation/ndctl/meson.build
new file mode 100644
index 000000000000..b82635a4cc4b
--- /dev/null
+++ b/Documentation/ndctl/meson.build
@@ -0,0 +1,124 @@
+if get_option('asciidoctor').enabled()
+  asciidoc_conf = custom_target('asciidoctor-extensions.rb',
+    command : [
+      'sed', '-e', 's,@Utility@,Ndctl,g', '-e', 's,@utility@,ndctl,g', '@INPUT@'
+    ],
+    input : '../asciidoctor-extensions.rb.in',
+    output : 'asciidoctor-extensions.rb',
+    capture : true,
+  )
+else
+  asciidoc_conf = custom_target('asciidoc.conf',
+    command : [
+      'sed', '-e', 's,UTILITY,ndctl,g',
+    ],
+    input : '../asciidoc.conf.in',
+    output : 'asciidoc.conf',
+    capture : true,
+  )
+endif
+
+filedeps = [
+        '../copyright.txt',
+        'region-description.txt',
+        'xable-region-options.txt',
+        'dimm-description.txt',
+        'xable-dimm-options.txt',
+        'xable-namespace-options.txt',
+        'ars-description.txt',
+        'labels-description.txt',
+        'labels-options.txt',
+]
+
+ndctl_manpages = [
+  'ndctl.txt',
+  'ndctl-wait-scrub.txt',
+  'ndctl-start-scrub.txt',
+  'ndctl-zero-labels.txt',
+  'ndctl-read-labels.txt',
+  'ndctl-write-labels.txt',
+  'ndctl-init-labels.txt',
+  'ndctl-check-labels.txt',
+  'ndctl-enable-region.txt',
+  'ndctl-disable-region.txt',
+  'ndctl-enable-dimm.txt',
+  'ndctl-disable-dimm.txt',
+  'ndctl-enable-namespace.txt',
+  'ndctl-disable-namespace.txt',
+  'ndctl-create-namespace.txt',
+  'ndctl-destroy-namespace.txt',
+  'ndctl-check-namespace.txt',
+  'ndctl-clear-errors.txt',
+  'ndctl-inject-error.txt',
+  'ndctl-inject-smart.txt',
+  'ndctl-update-firmware.txt',
+  'ndctl-list.txt',
+  'ndctl-monitor.txt',
+  'ndctl-setup-passphrase.txt',
+  'ndctl-update-passphrase.txt',
+  'ndctl-remove-passphrase.txt',
+  'ndctl-freeze-security.txt',
+  'ndctl-sanitize-dimm.txt',
+  'ndctl-load-keys.txt',
+  'ndctl-wait-overwrite.txt',
+  'ndctl-read-infoblock.txt',
+  'ndctl-write-infoblock.txt',
+  'ndctl-activate-firmware.txt',
+]
+
+foreach man : ndctl_manpages
+  name = man.split('.')[0]
+  output = name + '.1'
+  output_xml = name + '.xml'
+  if get_option('asciidoctor').enabled()
+    custom_target(name,
+      command : [
+        asciidoc,
+        '-b', 'manpage', '-d', 'manpage', '-acompat-mode', '-I', '@OUTDIR@',
+        '-rasciidoctor-extensions', '-amansource=ndctl',
+        '-amanmanual=ndctl Manual',
+	'-andctl_confdir=@0@'.format(ndctlconf_dir),
+	'-andctl_monitorconf=@0@'.format(ndctlconf),
+	'-andctl_keysdir=@0@'.format(ndctlkeys_dir),
+        '-andctl_version=@0@'.format(meson.project_version()),
+        '-o', '@OUTPUT@', '@INPUT@'
+      ],
+      input : man,
+      output : output,
+      depend_files : filedeps,
+      depends : asciidoc_conf,
+      install : get_option('docs').enabled(),
+      install_dir : join_paths(get_option('mandir'), 'man1'),
+    )
+  else
+    xml = custom_target(output_xml,
+      command : [
+        asciidoc,
+	'-b', 'docbook', '-d', 'manpage', '-f', asciidoc_conf, '--unsafe',
+	'-andctl_version=@0@'.format(meson.project_version()),
+	'-andctl_confdir=@0@'.format(ndctlconf_dir),
+	'-andctl_monitorconf=@0@'.format(ndctlconf),
+	'-andctl_keysdir=@0@'.format(ndctlkeys_dir),
+	'-o', '@OUTPUT@', '@INPUT@',
+      ],
+      input : man,
+      output : output_xml,
+      depend_files : filedeps,
+      depends : asciidoc_conf,
+    )
+
+    xsl = files('../manpage-normal.xsl')
+
+    custom_target(name,
+      command : [
+        xmlto, '-o', '@OUTDIR@', '-m', xsl, 'man', '@INPUT@'
+      ],
+      depends : xml,
+      depend_files : xsl,
+      input : xml,
+      output : output,
+      install : get_option('docs').enabled(),
+      install_dir : join_paths(get_option('mandir'), 'man1'),
+    )
+  endif
+endforeach
diff --git a/clean_config.sh b/clean_config.sh
new file mode 100755
index 000000000000..03ec04c5554b
--- /dev/null
+++ b/clean_config.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+git ls-files -o --exclude build | grep config.h\$ | xargs rm
diff --git a/config.h.meson b/config.h.meson
new file mode 100644
index 000000000000..98102251b494
--- /dev/null
+++ b/config.h.meson
@@ -0,0 +1,151 @@
+/* Debug messages. */
+#mesondefine ENABLE_DEBUG
+
+/* destructive functional tests support */
+#mesondefine ENABLE_DESTRUCTIVE
+
+/* Documentation / man pages. */
+#mesondefine ENABLE_DOCS
+
+/* Enable keyutils support */
+#mesondefine ENABLE_KEYUTILS
+
+/* System logging. */
+#mesondefine ENABLE_LOGGING
+
+/* ndctl test poison support */
+#mesondefine ENABLE_POISON
+
+/* ndctl test support */
+#mesondefine ENABLE_TEST
+
+/* Define to 1 if big-endian-arch */
+#mesondefine HAVE_BIG_ENDIAN
+
+/* Define to 1 if you have the declaration of `BUS_MCEERR_AR', and to 0 if you
+   don't. */
+#mesondefine HAVE_DECL_BUS_MCEERR_AR
+
+/* Define to 1 if you have the declaration of `MAP_SHARED_VALIDATE', and to 0
+   if you don't. */
+#mesondefine HAVE_DECL_MAP_SHARED_VALIDATE
+
+/* Define to 1 if you have the declaration of `MAP_SYNC', and to 0 if you
+   don't. */
+#mesondefine HAVE_DECL_MAP_SYNC
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#mesondefine HAVE_DLFCN_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#mesondefine HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <keyutils.h> header file. */
+#mesondefine HAVE_KEYUTILS_H
+
+/* Define to 1 if you have the <linux/version.h> header file. */
+#mesondefine HAVE_LINUX_VERSION_H
+
+/* Define to 1 if little-endian-arch */
+#mesondefine HAVE_LITTLE_ENDIAN
+
+/* Define to 1 if you have the <memory.h> header file. */
+#mesondefine HAVE_MEMORY_H
+
+/* Define to 1 if you have the `secure_getenv' function. */
+#mesondefine HAVE_SECURE_GETENV
+
+/* Define to 1 if you have statement expressions. */
+#mesondefine HAVE_STATEMENT_EXPR
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#mesondefine HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#mesondefine HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#mesondefine HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#mesondefine HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#mesondefine HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#mesondefine HAVE_SYS_TYPES_H
+
+/* Define to 1 if typeof works with your compiler. */
+#mesondefine HAVE_TYPEOF
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#mesondefine HAVE_UNISTD_H
+
+/* Define to 1 if using libuuid */
+#mesondefine HAVE_UUID
+
+/* Define to 1 if you have the `__secure_getenv' function. */
+#mesondefine HAVE___SECURE_GETENV
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#mesondefine LT_OBJDIR
+
+/* Name of package */
+#mesondefine PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#mesondefine PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#mesondefine PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#mesondefine PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#mesondefine PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#mesondefine PACKAGE_URL
+
+/* Define to the version of this package. */
+#mesondefine PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#mesondefine STDC_HEADERS
+
+/* Version number of package */
+#mesondefine VERSION
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#mesondefine _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#mesondefine _LARGE_FILES
+
+/* Define to 1 if on MINIX. */
+#mesondefine _MINIX
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+#mesondefine _POSIX_1_SOURCE
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#mesondefine _POSIX_SOURCE
+
+/* Define to __typeof__ if your compiler spells it that way. */
+#mesondefine typeof
+
+/* Define to enable GNU Source Extensions */
+#mesondefine _GNU_SOURCE
+
+/* Locations to install configuration files, key config, man pages, etc.. */
+#mesondefine NDCTL_CONF_FILE
+#mesondefine NDCTL_CONF_DIR
+#mesondefine DAXCTL_CONF_DIR
+#mesondefine NDCTL_KEYS_DIR
+#mesondefine NDCTL_MAN_PATH
+#mesondefine DAXCTL_MODPROBE_DATA
+#mesondefine DAXCTL_MODPROBE_INSTALL
+#mesondefine PREFIX
diff --git a/contrib/meson.build b/contrib/meson.build
new file mode 100644
index 000000000000..4ed3c20165b4
--- /dev/null
+++ b/contrib/meson.build
@@ -0,0 +1,28 @@
+bashcompletiondir = get_option('bashcompletiondir')
+if bashcompletiondir == ''
+  bash_completion = dependency('bash-completion', required : false)
+  if bash_completion.found()
+      bashcompletiondir = bash_completion.get_pkgconfig_variable('completionsdir')
+  else
+    bashcompletiondir = datadir / 'bash-completion/completions'
+  endif
+endif
+
+if bashcompletiondir != 'no'
+  install_data('ndctl', install_dir : bashcompletiondir)
+
+# TODO Switch to symlinks once 0.61.0 is more widely available
+#  install_symlink('daxctl',
+#    install_dir : bashcompletiondir,
+#    pointing_to : 'ndctl'
+#  )
+#  install_symlink('cxl',
+#    install_dir : bashcompletiondir,
+#    pointing_to : 'ndctl'
+#  )
+  install_data('ndctl', rename : 'daxctl', install_dir : bashcompletiondir)
+  install_data('ndctl', rename : 'cxl', install_dir : bashcompletiondir)
+endif
+
+modprobedatadir = get_option('sysconfdir') + '/modprobe.d/'
+install_data('nvdimm-security.conf', install_dir : modprobedatadir)
diff --git a/cxl/lib/meson.build b/cxl/lib/meson.build
new file mode 100644
index 000000000000..eba0ce7278e7
--- /dev/null
+++ b/cxl/lib/meson.build
@@ -0,0 +1,35 @@
+libcxl_version = '@0@.@1@.@2@'.format(
+  LIBCXL_CURRENT - LIBCXL_AGE,
+  LIBCXL_REVISION,
+  LIBCXL_AGE)
+
+mapfile = files('libcxl.sym')
+vflag = '-Wl,--version-script,@0@/@1@'.format(project_source_root, mapfile[0])
+
+cxl = library('cxl',
+  '../../util/sysfs.c',
+  '../../util/log.c',
+  '../../util/log.h',
+  'libcxl.c',
+  include_directories : root_inc,
+  dependencies : [
+    uuid,
+    kmod,
+  ],
+  version : libcxl_version,
+  install : true,
+  install_dir : rootlibdir,
+  link_args : vflag,
+  link_depends : mapfile,
+)
+cxl_dep = declare_dependency(link_with : cxl)
+
+custom_target(
+  'libcxl.pc',
+  command : pkgconfig_script + [ '@INPUT@' ],
+  input : 'libcxl.pc.in',
+  output : 'libcxl.pc',
+  capture : true,
+  install : true,
+  install_dir : pkgconfiglibdir,
+)
diff --git a/cxl/meson.build b/cxl/meson.build
new file mode 100644
index 000000000000..805924b9df9b
--- /dev/null
+++ b/cxl/meson.build
@@ -0,0 +1,25 @@
+cxl_src = [
+  'cxl.c',
+  'list.c',
+  'memdev.c',
+  '../util/json.c',
+  'json.c',
+  'filter.c',
+]
+
+cxl_tool = executable('cxl',
+  cxl_src,
+  include_directories : root_inc,
+  dependencies : [
+    cxl_dep,
+    util_dep,
+    uuid,
+    kmod,
+    json,
+    versiondep,
+  ],
+  install : true,
+  install_dir : rootbindir,
+)
+
+install_headers('libcxl.h', subdir : 'cxl')
diff --git a/daxctl/device.c b/daxctl/device.c
index d202f02d07e7..d2d206b95cae 100644
--- a/daxctl/device.c
+++ b/daxctl/device.c
@@ -8,6 +8,7 @@
 #include <limits.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <uuid/uuid.h>
 #include <sys/sysmacros.h>
 #include <util/size.h>
 #include <util/json.h>
diff --git a/daxctl/lib/meson.build b/daxctl/lib/meson.build
new file mode 100644
index 000000000000..b79c6e591945
--- /dev/null
+++ b/daxctl/lib/meson.build
@@ -0,0 +1,44 @@
+libdaxctl_version = '@0@.@1@.@2@'.format(
+  LIBDAXCTL_CURRENT - LIBDAXCTL_AGE,
+  LIBDAXCTL_REVISION,
+  LIBDAXCTL_AGE,
+)
+
+mapfile = files('libdaxctl.sym')
+vflag = '-Wl,--version-script,@0@/@1@'.format(project_source_root, mapfile[0])
+
+libdaxctl_src = [
+  '../../util/iomem.c',
+  '../../util/sysfs.c',
+  '../../util/log.c',
+  'libdaxctl.c',
+]
+
+daxctl = library(
+ 'daxctl',
+  libdaxctl_src,
+  version : libdaxctl_version,
+  include_directories : root_inc,
+  dependencies : [
+    uuid,
+    kmod,
+  ],
+  install : true,
+  install_dir : rootlibdir,
+  link_args : vflag,
+  link_depends : mapfile,
+)
+
+daxctl_dep = declare_dependency(link_with : daxctl)
+
+custom_target(
+  'libdaxctl.pc',
+  command : pkgconfig_script + [ '@INPUT@' ],
+  input : 'libdaxctl.pc.in',
+  output : 'libdaxctl.pc',
+  capture : true,
+  install : true,
+  install_dir : pkgconfiglibdir,
+)
+
+install_data('daxctl.conf', install_dir : datadir / 'daxctl')
diff --git a/daxctl/meson.build b/daxctl/meson.build
new file mode 100644
index 000000000000..ec2e2b648d40
--- /dev/null
+++ b/daxctl/meson.build
@@ -0,0 +1,35 @@
+daxctl_src = [
+  'daxctl.c',
+  'acpi.c',
+  'list.c',
+  'migrate.c',
+  'device.c',
+  '../util/json.c',
+  'json.c',
+  'filter.c',
+]
+
+daxctl_tool = executable('daxctl',
+  daxctl_src,
+  include_directories : root_inc,
+  dependencies : [
+    daxctl_dep,
+    ndctl_dep,
+    iniparser,
+    util_dep,
+    uuid,
+    kmod,
+    json,
+    versiondep,
+  ],
+  install : true,
+  install_dir : rootbindir,
+)
+
+install_headers('libdaxctl.h', subdir : 'daxctl')
+
+install_data('daxctl.example.conf', install_dir : daxctlconf_dir )
+if get_option('systemd').enabled()
+  install_data('90-daxctl-device.rules', install_dir : udevrulesdir)
+  install_data('daxdev-reconfigure@.service', install_dir : systemdunitdir)
+endif
diff --git a/meson.build b/meson.build
new file mode 100644
index 000000000000..272ac642c193
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,280 @@
+project('ndctl', 'c',
+  version : '72',
+  license : [
+    'GPL-2.0',
+    'LGPL-2.1',
+    'CC0-1.0',
+    'MIT',
+  ],
+  default_options : [
+    'c_std=gnu99',
+    'prefix=/usr',
+    'sysconfdir=/etc',
+    'localstatedir=/var',
+  ],
+)
+
+# rootprefixdir and rootlibdir setup copied from systemd:
+rootprefixdir = get_option('rootprefix')
+rootprefix_default = '/usr'
+if rootprefixdir == ''
+        rootprefixdir = rootprefix_default
+endif
+rootbindir = join_paths(rootprefixdir, 'bin')
+
+# join_paths ignores the preceding arguments if an absolute component is
+# encountered, so this should canonicalize various paths when they are
+# absolute or relative.
+prefixdir = get_option('prefix')
+if not prefixdir.startswith('/')
+        error('Prefix is not absolute: "@0@"'.format(prefixdir))
+endif
+if prefixdir != rootprefixdir and rootprefixdir != '/' and not prefixdir.strip('/').startswith(rootprefixdir.strip('/') + '/')
+  error('Prefix is not below root prefix (now rootprefix=@0@ prefix=@1@)'.format(
+	rootprefixdir, prefixdir))
+endif
+
+libdir = join_paths(prefixdir, get_option('libdir'))
+rootlibdir = get_option('rootlibdir')
+if rootlibdir == ''
+  rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
+endif
+datadir = prefixdir / get_option('datadir')
+includedir = prefixdir / get_option('includedir')
+
+pkgconfiglibdir = get_option('pkgconfiglibdir') != '' ? get_option('pkgconfiglibdir') : libdir / 'pkgconfig'
+
+datadir = prefixdir / get_option('datadir')
+includedir = prefixdir / get_option('includedir')
+sysconfdir =  get_option('sysconfdir')
+
+pkgconfig_script = '''
+sed -e s,@VERSION@,@0@,g
+    -e s,@prefix@,@1@,g
+    -e s,@exec_prefix@,@1@,g
+    -e s,@libdir@,@2@,g
+    -e s,@includedir@,@3@,g
+'''.format(meson.project_version(), prefixdir, libdir, includedir).split()
+
+cc_flags = [
+  '-Wall',
+  '-Wchar-subscripts',
+  '-Wformat-security',
+  '-Wmissing-declarations',
+  '-Wmissing-prototypes',
+  '-Wnested-externs ',
+  '-Wshadow',
+  '-Wsign-compare',
+  '-Wstrict-prototypes',
+  '-Wtype-limits',
+  '-Wmaybe-uninitialized',
+  '-Wdeclaration-after-statement',
+  '-Wunused-result',
+  '-D_FORTIFY_SOURCE=2',
+  '-O2',
+]
+cc = meson.get_compiler('c')
+add_project_arguments(cc.get_supported_arguments(cc_flags), language : 'c')
+
+project_source_root = meson.current_source_dir()
+
+# Remove this after the conversion to meson has been completed
+# Cleanup the leftover config.h files to avoid conflicts with the meson
+# generated config.h
+git = find_program('git', required : false)
+if git.found()
+  run_command('clean_config.sh',
+    env : 'GIT_DIR=@0@/.git'.format(project_source_root),
+  )
+endif
+
+version_tag = get_option('version-tag')
+if version_tag != ''
+  vcs_data = configuration_data()
+  vcs_data.set('VCS_TAG', version_tag)
+  version_h = configure_file(
+    configuration : vcs_data,
+    input : 'version.h.in',
+    output : 'version.h'
+  )
+else
+  vcs_tagger = [
+    project_source_root + '/tools/meson-vcs-tag.sh',
+    project_source_root,
+    meson.project_version()
+  ]
+
+  version_h = vcs_tag(
+      input : 'version.h.in',
+      output : 'version.h',
+      command: vcs_tagger
+  )
+endif
+
+versiondep = declare_dependency(
+  compile_args: ['-include', 'version.h'],
+  sources: version_h
+)
+
+kmod = dependency('libkmod')
+libudev = dependency('libudev')
+uuid = dependency('uuid')
+json = dependency('json-c')
+if get_option('docs').enabled()
+  if get_option('asciidoctor').enabled()
+    asciidoc = find_program('asciidoctor', required : true)
+  else
+    asciidoc = find_program('asciidoc', required : true)
+    xmlto = find_program('xmlto', required : true)
+  endif
+endif
+
+if get_option('systemd').enabled()
+  systemd = dependency('systemd', required : true)
+  systemdunitdir = systemd.get_pkgconfig_variable('systemd_system_unit_dir')
+  udev = dependency('udev', required : true)
+  udevdir = udev.get_pkgconfig_variable('udevdir')
+  udevrulesdir = udevdir / 'rules.d'
+endif
+
+cc = meson.get_compiler('c')
+
+# keyutils and iniparser lack pkgconfig
+keyutils = cc.find_library('keyutils', required : get_option('keyutils'))
+iniparser = cc.find_library('iniparser', required : true)
+
+conf = configuration_data()
+check_headers = [
+  ['HAVE_DLFCN_H', 'dlfcn.h'],
+  ['HAVE_INTTYPES_H', 'inttypes.h'],
+  ['HAVE_KEYUTILS_H', 'keyutils.h'],
+  ['HAVE_LINUX_VERSION_H', 'linux/version.h'],
+  ['HAVE_MEMORY_H', 'memory.h'],
+  ['HAVE_STDINT_H', 'stdint.h'],
+  ['HAVE_STDLIB_H', 'stdlib.h'],
+  ['HAVE_STRINGS_H', 'strings.h'],
+  ['HAVE_STRING_H', 'string.h'],
+  ['HAVE_SYS_STAT_H', 'sys/stat.h'],
+  ['HAVE_SYS_TYPES_H', 'sys/types.h'],
+  ['HAVE_UNISTD_H', 'unistd.h'],
+]
+
+foreach h : check_headers
+  if cc.has_header(h.get(1))
+    conf.set(h.get(0), 1)
+  endif
+endforeach
+
+map_sync_symbols = [
+  [ 'signal.h', 'BUS_MCEERR_AR' ],
+  [ 'linux/mman.h', 'MAP_SHARED_VALIDATE' ],
+  [ 'linux/mman.h', 'MAP_SYNC' ],
+]
+
+count = 0
+foreach symbol : map_sync_symbols
+  if cc.has_header_symbol(symbol[0], symbol[1])
+    conf.set('HAVE_DECL_@0@'.format(symbol[1].to_upper()), 1)
+    count = count + 1
+  endif
+endforeach
+
+poison_enabled = false
+if get_option('poison').enabled() and count == 3
+  poison_enabled = true
+endif
+
+conf.set('ENABLE_POISON', poison_enabled)
+conf.set('ENABLE_KEYUTILS', get_option('keyutils').enabled())
+conf.set('ENABLE_TEST', get_option('test').enabled())
+conf.set('ENABLE_DESTRUCTIVE', get_option('destructive').enabled())
+conf.set('ENABLE_LOGGING', get_option('logging').enabled())
+conf.set('ENABLE_DEBUG', get_option('dbg').enabled())
+
+typeof = cc.run('''
+  int main() {
+    struct {
+      char a[16];
+    } x;
+    typeof(x) y;
+
+    return sizeof(x) == sizeof(y);
+  }
+  '''
+)
+
+if typeof.compiled() and typeof.returncode() == 1
+  conf.set('HAVE_TYPEOF', 1)
+  conf.set('HAVE_STATEMENT_EXPR', 1)
+endif
+
+if target_machine.endian() == 'big'
+  conf.set('HAVE_BIG_ENDIAN', 1)
+else
+  conf.set('HAVE_LITTLE_ENDIAN', 1)
+endif
+
+conf.set('_GNU_SOURCE', true)
+conf.set_quoted('PREFIX', get_option('prefix'))
+conf.set_quoted('NDCTL_MAN_PATH', get_option('mandir'))
+
+foreach ident : ['secure_getenv', '__secure_getenv']
+  conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
+endforeach
+
+
+ndctlconf_dir = sysconfdir / 'ndctl.conf.d'
+ndctlconf = ndctlconf_dir / 'monitor.conf'
+conf.set_quoted('NDCTL_CONF_FILE', ndctlconf)
+conf.set_quoted('NDCTL_CONF_DIR', ndctlconf_dir)
+
+ndctlkeys_dir = sysconfdir / 'ndctl' / 'keys'
+conf.set_quoted('NDCTL_KEYS_DIR', ndctlkeys_dir)
+
+daxctlconf_dir = sysconfdir / 'daxctl.conf.d'
+daxctlconf = daxctlconf_dir / 'dax.conf'
+conf.set_quoted('DAXCTL_CONF_DIR', daxctlconf_dir)
+
+conf.set_quoted('DAXCTL_MODPROBE_DATA', datadir / 'daxctl/daxctl.conf')
+conf.set_quoted('DAXCTL_MODPROBE_INSTALL', sysconfdir / 'modprobe.d/daxctl.conf')
+
+config_h = configure_file(
+  input : 'config.h.meson',
+  output : 'config.h',
+  configuration : conf
+)
+add_project_arguments('-include', 'config.h', language : 'c')
+
+LIBNDCTL_CURRENT=25
+LIBNDCTL_REVISION=1
+LIBNDCTL_AGE=19
+
+LIBDAXCTL_CURRENT=6
+LIBDAXCTL_REVISION=0
+LIBDAXCTL_AGE=5
+
+LIBCXL_CURRENT=1
+LIBCXL_REVISION=0
+LIBCXL_AGE=0
+
+root_inc = include_directories(['.', 'ndctl', ])
+
+ccan = static_library('ccan',
+  [ 'ccan/str/str.c', 'ccan/list/list.c' ],
+)
+ccan_dep = declare_dependency(link_with : ccan)
+
+subdir('daxctl/lib')
+subdir('ndctl/lib')
+subdir('cxl/lib')
+subdir('util')
+subdir('ndctl')
+subdir('daxctl')
+subdir('cxl')
+if get_option('docs').enabled()
+  subdir('Documentation/ndctl')
+  subdir('Documentation/daxctl')
+  subdir('Documentation/cxl')
+endif
+subdir('test')
+subdir('contrib')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 000000000000..95312bfcb0d3
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,25 @@
+option('version-tag', type : 'string',
+       description : 'override the git version string')
+option('docs', type : 'feature', value : 'enabled')
+option('asciidoctor', type : 'feature', value : 'disabled')
+option('systemd', type : 'feature', value : 'enabled')
+option('keyutils', type : 'feature', value : 'enabled',
+  description : 'enable nvdimm device passphrase management')
+option('test', type : 'feature', value : 'disabled',
+  description : 'enable shipping tests in ndctl')
+option('destructive', type : 'feature', value : 'disabled',
+  description : 'enable tests that may clobber live system resources')
+option('poison', type : 'feature', value : 'enabled',
+  description : 'enable tests that inject poison / memory-failure')
+option('logging', type : 'feature', value : 'enabled',
+  description : 'enable log infrastructure')
+option('dbg', type : 'feature', value : 'enabled',
+  description : 'enable dbg messages')
+option('rootprefix', type : 'string',
+       description : '''override the root prefix [default '/' if split-usr and '/usr' otherwise]''')
+option('rootlibdir', type : 'string',
+       description : '''[/usr]/lib/x86_64-linux-gnu or such''')
+option('pkgconfiglibdir', type : 'string', value : '',
+       description : 'directory for standard pkg-config files')
+option('bashcompletiondir', type : 'string',
+       description : '''${datadir}/bash-completion/completions''')
diff --git a/ndctl/lib/meson.build b/ndctl/lib/meson.build
new file mode 100644
index 000000000000..abce87948cf2
--- /dev/null
+++ b/ndctl/lib/meson.build
@@ -0,0 +1,48 @@
+libndctl_version = '@0@.@1@.@2@'.format(
+  LIBNDCTL_CURRENT - LIBNDCTL_AGE,
+  LIBNDCTL_REVISION,
+  LIBNDCTL_AGE)
+
+mapfile = files('libndctl.sym')
+vflag = '-Wl,--version-script,@0@/@1@'.format(project_source_root, mapfile[0])
+
+ndctl = library(
+ 'ndctl',
+  '../../util/log.c',
+  '../../util/sysfs.c',
+  'dimm.c',
+  'inject.c',
+  'nfit.c',
+  'smart.c',
+  'intel.c',
+  'hpe1.c',
+  'msft.c',
+  'hyperv.c',
+  'papr.c',
+  'ars.c',
+  'firmware.c',
+  'libndctl.c',
+  dependencies : [
+    daxctl_dep,
+    libudev,
+    uuid,
+    kmod,
+  ],
+  include_directories : root_inc,
+  version : libndctl_version,
+  install : true,
+  install_dir : rootlibdir,
+  link_args : vflag,
+  link_depends : mapfile,
+)
+ndctl_dep = declare_dependency(link_with : ndctl)
+
+custom_target(
+  'libndctl.pc',
+  command : pkgconfig_script + [ '@INPUT@' ],
+  input : 'libndctl.pc.in',
+  output : 'libndctl.pc',
+  capture : true,
+  install : true,
+  install_dir : pkgconfiglibdir,
+)
diff --git a/ndctl/meson.build b/ndctl/meson.build
new file mode 100644
index 000000000000..6a3d0e5348c2
--- /dev/null
+++ b/ndctl/meson.build
@@ -0,0 +1,82 @@
+ndctl_src = [
+  'ndctl.c',
+  'bus.c',
+  'create-nfit.c',
+  'namespace.c',
+  'check.c',
+  'region.c',
+  'dimm.c',
+  '../util/log.c',
+  '../daxctl/filter.c',
+  'filter.c',
+  'list.c',
+  '../util/json.c',
+  '../daxctl/json.c',
+  'json.c',
+  'json-smart.c',
+  'inject-error.c',
+  'inject-smart.c',
+  'monitor.c',
+]
+
+deps = [
+  util_dep,
+  ndctl_dep,
+  daxctl_dep,
+  cxl_dep,
+  uuid,
+  kmod,
+  json,
+  iniparser,
+  versiondep,
+]
+
+if get_option('keyutils').enabled()
+  ndctl_src += [
+    'keys.c',
+    'load-keys.c',
+  ]
+  deps += keyutils
+endif
+
+if get_option('test').enabled()
+  ndctl_src += [
+  '../test/libndctl.c',
+  '../test/dsm-fail.c',
+  '../util/sysfs.c',
+  '../test/core.c',
+  'test.c',
+]
+endif
+
+if get_option('destructive').enabled()
+  if get_option('test').disabled()
+    error('\'-D=destructive=enabled\' requires \'-Dtest=enabled\'\n')
+  endif
+  ndctl_src += [
+    '../test/pmem_namespaces.c',
+    'bat.c',
+  ]
+endif
+
+if get_option('systemd').enabled()
+  install_data('ndctl-monitor.service', install_dir : systemdunitdir)
+endif
+install_data('monitor.conf', install_dir : ndctlconf_dir)
+install_data('ndctl.conf', install_dir : ndctlconf_dir)
+install_data('keys.readme', install_dir : ndctlkeys_dir)
+
+ndctl_tool = executable('ndctl', ndctl_src,
+  dependencies : deps,
+  install : true,
+  install_dir : rootbindir,
+  include_directories : root_inc,
+)
+
+install_headers(
+  [
+    'libndctl.h',
+    'ndctl.h'
+  ],
+  subdir : 'ndctl'
+)
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 000000000000..94287aaef85b
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,237 @@
+testcore = [
+  'core.c',
+  '../util/log.c',
+  '../util/sysfs.c',
+]
+
+libndctl_deps = [
+  ndctl_dep,
+  daxctl_dep,
+  uuid,
+  kmod,
+]
+
+ndctl_deps = libndctl_deps + [
+  json,
+  util_dep,
+  versiondep,
+]
+
+libndctl = executable('libndctl', testcore + [ 'libndctl.c'],
+  dependencies : libndctl_deps,
+  include_directories : root_inc,
+)
+
+namespace_core = [
+  '../ndctl/namespace.c',
+  '../ndctl/filter.c',
+  '../ndctl/check.c',
+  '../util/json.c',
+  '../ndctl/json.c',
+  '../daxctl/filter.c',
+  '../daxctl/json.c',
+]
+
+dsm_fail = executable('dsm-fail', testcore + namespace_core + [ 'dsm-fail.c' ],
+  dependencies : ndctl_deps,
+  include_directories : root_inc,
+)
+
+hugetlb_src = testcore + [ 'hugetlb.c', 'dax-pmd.c' ]
+if poison_enabled
+  hugetlb_src += [ 'dax-poison.c' ]
+endif
+hugetlb = executable('hugetlb', hugetlb_src,
+  dependencies : libndctl_deps,
+  include_directories : root_inc,
+)
+
+ack_shutdown_count = executable('ack-shutdown-count-set',
+  testcore + [ 'ack-shutdown-count-set.c' ],
+  dependencies : libndctl_deps,
+  include_directories : root_inc,
+)
+
+dax_errors = executable('dax-errors',
+  'dax-errors.c',
+)
+
+smart_notify = executable('smart-notify', 'smart-notify.c',
+  dependencies : libndctl_deps,
+  include_directories : root_inc,
+)
+
+smart_listen = executable('smart-listen', 'smart-listen.c',
+  dependencies : libndctl_deps,
+  include_directories : root_inc,
+)
+
+daxdev_errors = executable('daxdev-errors', [
+    'daxdev-errors.c',
+    '../util/log.c',
+    '../util/sysfs.c',
+  ],
+  dependencies : libndctl_deps,
+  include_directories : root_inc,
+)
+
+list_smart_dimm = executable('list-smart-dimm', [
+    'list-smart-dimm.c',
+    '../ndctl/filter.c',
+    '../util/json.c',
+    '../ndctl/json.c',
+    '../daxctl/json.c',
+    '../daxctl/filter.c',
+  ],
+  dependencies : ndctl_deps,
+  include_directories : root_inc,
+)
+
+pmem_ns = executable('pmem-ns', testcore + [ 'pmem_namespaces.c' ],
+  dependencies : libndctl_deps,
+  include_directories : root_inc,
+)
+
+dax_dev = executable('dax-dev', testcore + [ 'dax-dev.c' ],
+  dependencies : libndctl_deps,
+  include_directories : root_inc,
+)
+
+dax_pmd_src = testcore + [ 'dax-pmd.c' ]
+if poison_enabled
+  dax_pmd_src += [ 'dax-poison.c' ]
+endif
+
+dax_pmd = executable('dax-pmd', dax_pmd_src,
+  dependencies : libndctl_deps,
+  include_directories : root_inc,
+)
+
+device_dax_src = testcore + namespace_core + [
+  'device-dax.c',
+  'dax-dev.c',
+  'dax-pmd.c',
+]
+
+if poison_enabled
+  device_dax_src += 'dax-poison.c'
+endif
+
+device_dax = executable('device-dax', device_dax_src,
+  dependencies : ndctl_deps,
+  include_directories : root_inc,
+)
+
+revoke_devmem = executable('revoke_devmem', testcore + [
+    'revoke-devmem.c',
+    'dax-dev.c',
+  ],
+  dependencies : libndctl_deps,
+  include_directories : root_inc,
+)
+
+mmap = executable('mmap', 'mmap.c',)
+
+create = find_program('create.sh')
+clear = find_program('clear.sh')
+pmem_errors = find_program('pmem-errors.sh')
+daxdev_errors_sh = find_program('daxdev-errors.sh')
+multi_dax = find_program('multi-dax.sh')
+btt_check = find_program('btt-check.sh')
+label_compat = find_program('label-compat.sh')
+sector_mode = find_program('sector-mode.sh')
+inject_error = find_program('inject-error.sh')
+btt_errors = find_program('btt-errors.sh')
+btt_pad_compat = find_program('btt-pad-compat.sh')
+firmware_update = find_program('firmware-update.sh')
+rescan_partitions = find_program('rescan-partitions.sh')
+inject_smart = find_program('inject-smart.sh')
+monitor = find_program('monitor.sh')
+max_extent = find_program('max_available_extent_ns.sh')
+pfn_meta_errors = find_program('pfn-meta-errors.sh')
+track_uuid = find_program('track-uuid.sh')
+
+tests = [
+  [ 'libndctl',               libndctl ],
+  [ 'dsm-fail',               dsm_fail ],
+  [ 'create.sh',              create ],
+  [ 'clear.sh',               clear ],
+  [ 'pmem-errors.sh',         pmem_errors ],
+  [ 'daxdev-errors.sh',       daxdev_errors_sh ],
+  [ 'multi-dax.sh',           multi_dax ],
+  [ 'btt-check.sh',           btt_check ],
+  [ 'label-compat.sh',        label_compat ],
+  [ 'sector-mode.sh',         sector_mode ],
+  [ 'inject-error.sh',        inject_error ],
+  [ 'btt-errors.sh',          btt_errors ],
+  [ 'hugetlb',                hugetlb ],
+  [ 'btt-pad-compat.sh',      btt_pad_compat ],
+  [ 'firmware-update.sh',     firmware_update ],
+  [ 'ack-shutdown-count-set', ack_shutdown_count ],
+  [ 'rescan-partitions.sh',   rescan_partitions ],
+  [ 'inject-smart.sh',        inject_smart ],
+  [ 'monitor.sh',             monitor ],
+  [ 'max_extent_ns',          max_extent ],
+  [ 'pfn-meta-errors.sh',     pfn_meta_errors ],
+  [ 'track-uuid.sh',          track_uuid ],
+]
+
+if get_option('destructive').enabled()
+  sub_section = find_program('sub-section.sh')
+  dax_ext4 = find_program('dax-ext4.sh')
+  dax_xfs = find_program('dax-xfs.sh')
+  align = find_program('align.sh')
+  device_dax_fio = find_program('device-dax-fio.sh')
+  daxctl_devices = find_program('daxctl-devices.sh')
+  daxctl_create = find_program('daxctl-create.sh')
+  dm = find_program('dm.sh')
+  mmap_test = find_program('mmap.sh')
+
+  tests += [
+    [ 'pmem-ns',           pmem_ns ],
+    [ 'sub-section.sh',    sub_section ],
+    [ 'dax-dev',           dax_dev ],
+    [ 'dax-ext4.sh',       dax_ext4 ],
+    [ 'dax-xfs.sh',        dax_xfs ],
+    [ 'align.sh',          align ],
+    [ 'device-dax',        device_dax ],
+    [ 'revoke-devmem',     revoke_devmem ],
+    [ 'device-dax-fio.sh', device_dax_fio ],
+    [ 'daxctl-devices.sh', daxctl_devices ],
+    [ 'daxctl-create.sh',  daxctl_create ],
+    [ 'dm.sh',             dm ],
+    [ 'mmap.sh',           mmap_test ],
+  ]
+endif
+
+if get_option('keyutils').enabled()
+  security = find_program('security.sh')
+  tests += [
+    [ 'security.sh', security ]
+  ]
+endif
+
+foreach t : tests
+  test(t[0], t[1],
+    is_parallel : false,
+    depends : [
+      ndctl_tool,
+      daxctl_tool,
+      cxl_tool,
+      smart_notify,
+      list_smart_dimm,
+      dax_pmd,
+      dax_errors,
+      daxdev_errors,
+      dax_dev,
+      mmap,
+    ],
+    timeout : 0,
+    env : [
+      'NDCTL=@0@'.format(ndctl_tool.full_path()),
+      'DAXCTL=@0@'.format(daxctl_tool.full_path()),
+      'TEST_PATH=@0@'.format(meson.current_build_dir()),
+      'DATA_PATH=@0@'.format(meson.current_source_dir()),
+    ],
+  )
+endforeach
diff --git a/tools/meson-vcs-tag.sh b/tools/meson-vcs-tag.sh
new file mode 100755
index 000000000000..9f21c37b7d26
--- /dev/null
+++ b/tools/meson-vcs-tag.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+set -eu
+set -o pipefail
+
+dir="${1:?}"
+fallback="${2:?}"
+
+# Apparently git describe has a bug where it always considers the work-tree
+# dirty when invoked with --git-dir (even though 'git status' is happy). Work
+# around this issue by cd-ing to the source directory.
+cd "$dir"
+# Check that we have either .git/ (a normal clone) or a .git file (a work-tree)
+# and that we don't get confused if a tarball is extracted in a higher-level
+# git repository.
+[ -e .git ] && git describe --abbrev=7 --dirty=+ 2>/dev/null | \
+	sed -e 's/^v//' -e 's/-/./g' || echo "$fallback"
diff --git a/util/meson.build b/util/meson.build
new file mode 100644
index 000000000000..784b27915649
--- /dev/null
+++ b/util/meson.build
@@ -0,0 +1,16 @@
+util = static_library('util', [
+  'parse-options.c',
+  'parse-configs.c',
+  'usage.c',
+  'size.c',
+  'main.c',
+  'help.c',
+  'strbuf.c',
+  'wrapper.c',
+  'bitmap.c',
+  'abspath.c',
+  'iomem.c',
+  ],
+  include_directories : root_inc,
+)
+util_dep = declare_dependency(link_with : util)
diff --git a/version.h.in b/version.h.in
new file mode 100644
index 000000000000..dedbaf95caf7
--- /dev/null
+++ b/version.h.in
@@ -0,0 +1,2 @@
+/* SPDX-License-Identifier: LGPL-2.1 */
+#define VERSION "@VCS_TAG@"


^ permalink raw reply related

* [ndctl PATCH v3 11/16] build: Drop unnecessary $tool/config.h includes
From: Dan Williams @ 2022-01-05 21:32 UTC (permalink / raw)
  To: vishal.l.verma; +Cc: nvdimm, linux-cxl
In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com>

In preparation for support for meson as the build infrastructure remove
some explicit config.h includes that will be replaced by a unified config.h
at the top of the project.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 daxctl/migrate.c |    1 -
 ndctl/keys.c     |    1 -
 ndctl/monitor.c  |    1 -
 3 files changed, 3 deletions(-)

diff --git a/daxctl/migrate.c b/daxctl/migrate.c
index 5fbe970fdaff..c51106625849 100644
--- a/daxctl/migrate.c
+++ b/daxctl/migrate.c
@@ -5,7 +5,6 @@
 #include <stdio.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <daxctl/config.h>
 #include <daxctl/libdaxctl.h>
 #include <util/parse-options.h>
 #include <ccan/array_size/array_size.h>
diff --git a/ndctl/keys.c b/ndctl/keys.c
index 876b34714b7e..2f33b8fb488c 100644
--- a/ndctl/keys.c
+++ b/ndctl/keys.c
@@ -13,7 +13,6 @@
 #include <keyutils.h>
 #include <syslog.h>
 
-#include <ndctl/config.h>
 #include <ndctl/ndctl.h>
 #include <ndctl/libndctl.h>
 
diff --git a/ndctl/monitor.c b/ndctl/monitor.c
index 8b600a4e762b..ae694c614593 100644
--- a/ndctl/monitor.c
+++ b/ndctl/monitor.c
@@ -11,7 +11,6 @@
 #include <util/parse-options.h>
 #include <util/parse-configs.h>
 #include <util/strbuf.h>
-#include <ndctl/config.h>
 #include <ndctl/ndctl.h>
 #include <ndctl/libndctl.h>
 #include <sys/epoll.h>


^ permalink raw reply related

* Re: [PATCH v2] drm/msm/dp: populate connector of struct dp_panel
From: Stephen Boyd @ 2022-01-05 21:34 UTC (permalink / raw)
  To: Kuogee Hsieh, agross, airlied, bjorn.andersson, daniel,
	dmitry.baryshkov, robdclark, sean, vkoul
  Cc: quic_sbillaka, linux-arm-msm, quic_abhinavk, dri-devel,
	linux-kernel, aravindh, freedreno
In-Reply-To: <1640805422-21904-1-git-send-email-quic_khsieh@quicinc.com>

Quoting Kuogee Hsieh (2021-12-29 11:17:02)
> There is kernel crashed due to unable to handle kernel NULL
> pointer dereference of dp_panel->connector while running DP link
> layer compliance test case 4.2.2.6 (EDID Corruption Detection).

Can you explain how we get into that situation? Like

"We never assign struct dp_panel::connector, instead the connector is
stored in struct msm_dp::connector. When we run compliance testing test
case 4.2.2.6 dp_panel_handle_sink_request() won't have a valid edid set
in struct dp_panel::edid so we'll try to use the connectors
real_edid_checksum and hit a NULL pointer deref error because the
connector pointer is never assigned."

> This patch fixes this problem by populating connector of dp_panel.
>
> [drm:dp_panel_read_sink_caps] *ERROR* panel edid read failed
> Unable to handle kernel NULL pointer dereference at virtual address 00000000000006e1
> Mem abort info:
>   ESR = 0x96000006
>   EC = 0x25: DABT (current EL), IL = 32 bits
>   SET = 0, FnV = 0
>   EA = 0, S1PTW = 0
> Data abort info:
>   ISV = 0, ISS = 0x00000006
>   CM = 0, WnR = 0
> user pgtable: 4k pages, 39-bit VAs, pgdp=0000000115f25000
> [00000000000006e1] pgd=00000001174fe003, p4d=00000001174fe003, pud=00000001174fe003, pmd=0000000000000000
> Internal error: Oops: 96000006 [#1] PREEMPT SMP

This sort of stuff isn't really useful because it takes quite a few
lines to say "We hit a NULL pointer deref" which was already stated. I'd
rather have a clear description of what goes wrong and how setting the
pointer in msm_dp_modeset_init() fixes it.

> {...]
>
> Changes in V2:
> -- populate panel connector at msm_dp_modeset_init() instead of at dp_panel_read_sink_caps()
>
> Fixes: 7948fe12d47 ("drm/msm/dp: return correct edid checksum after corrupted edid checksum read")
> Signee-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> ---
>  drivers/gpu/drm/msm/dp/dp_display.c | 25 +++++++++++++++----------
>  1 file changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> index 3449d3f..c282bbf 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -1495,36 +1495,41 @@ void msm_dp_debugfs_init(struct msm_dp *dp_display, struct drm_minor *minor)
>         }
>  }
>
> -int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev,
> +int msm_dp_modeset_init(struct msm_dp *dp, struct drm_device *dev,
>                         struct drm_encoder *encoder)
>  {
>         struct msm_drm_private *priv;
> +       struct dp_display_private *dp_display;
>         int ret;
>
> -       if (WARN_ON(!encoder) || WARN_ON(!dp_display) || WARN_ON(!dev))
> +       if (WARN_ON(!encoder) || WARN_ON(!dp) || WARN_ON(!dev))
>                 return -EINVAL;
>
>         priv = dev->dev_private;
> -       dp_display->drm_dev = dev;
> +       dp->drm_dev = dev;
> +
> +       dp_display = container_of(dp, struct dp_display_private, dp_display);
>
> -       ret = dp_display_request_irq(dp_display);
> +       ret = dp_display_request_irq(dp);
>         if (ret) {
>                 DRM_ERROR("request_irq failed, ret=%d\n", ret);
>                 return ret;
>         }
>
> -       dp_display->encoder = encoder;
> +       dp->encoder = encoder;
>
> -       dp_display->connector = dp_drm_connector_init(dp_display);
> -       if (IS_ERR(dp_display->connector)) {
> -               ret = PTR_ERR(dp_display->connector);
> +       dp->connector = dp_drm_connector_init(dp);
> +       if (IS_ERR(dp->connector)) {
> +               ret = PTR_ERR(dp->connector);
>                 DRM_DEV_ERROR(dev->dev,
>                         "failed to create dp connector: %d\n", ret);
> -               dp_display->connector = NULL;
> +               dp->connector = NULL;
>                 return ret;
>         }
>
> -       priv->connectors[priv->num_connectors++] = dp_display->connector;
> +       dp_display->panel->connector = dp->connector;

This is the one line that matters I think? Can we reach the connector
for the dp device without going through the panel in
dp_panel_handle_sink_request()? That would reduce the number of struct
elements if possible.

> +
> +       priv->connectors[priv->num_connectors++] = dp->connector;

Can we not rename all the local variables in this patch and do it later
or never? Reading this patch takes a long time because we have to make
sure nothing has actually changed with the rename of 'dp_display' to
'dp'.

>         return 0;
>  }
>
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>

^ permalink raw reply

* Re: [v5 7/9] RISC-V: Add sscofpmf extension support
From: Atish Patra @ 2022-01-05 21:34 UTC (permalink / raw)
  To: Eric Lin; +Cc: Atish Patra, Atish Patra, linux-riscv
In-Reply-To: <CAPqJEFp8Bss6ND1AmZRPLTJJSTSiPacvSe9y-EgLwfBwTrf8Yg@mail.gmail.com>

On Tue, Jan 4, 2022 at 11:44 PM Eric Lin <eric.lin@sifive.com> wrote:
>
> Hi Atish,
>
> >
> > From: Atish Patra <atish.patra@wdc.com>
> >
> > The sscofpmf extension allows counter overflow and filtering for
> > programmable counters. Enable the perf driver to handle the overflow
> > interrupt. The overflow interrupt is a hart local interrupt.
> > Thus, per cpu overflow interrupts are setup as a child under the root
> > INTC irq domain.
> >
> > Signed-off-by: Atish Patra <atish.patra@wdc.com>
> > Signed-off-by: Atish Patra <atishp@rivosinc.com>
> > ---
> >  arch/riscv/include/asm/csr.h   |   8 +-
> >  arch/riscv/include/asm/hwcap.h |   1 +
> >  arch/riscv/kernel/cpufeature.c |   1 +
> >  drivers/perf/riscv_pmu_sbi.c   | 218 +++++++++++++++++++++++++++++++--
> >  include/linux/perf/riscv_pmu.h |   2 +
> >  5 files changed, 222 insertions(+), 8 deletions(-)
> >
> > diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/asm/csr.h
> > index e4d369830af4..8518eb0014bc 100644
> > --- a/arch/riscv/include/asm/csr.h
> > +++ b/arch/riscv/include/asm/csr.h
> > @@ -63,6 +63,7 @@
> >  #define IRQ_M_TIMER            7
> >  #define IRQ_S_EXT              9
> >  #define IRQ_M_EXT              11
> > +#define IRQ_PMU_OVF            13
> >
> >  /* Exception causes */
> >  #define EXC_INST_MISALIGNED    0
> > @@ -151,6 +152,8 @@
> >  #define CSR_HPMCOUNTER30H      0xc9e
> >  #define CSR_HPMCOUNTER31H      0xc9f
> >
> > +#define CSR_SSCOUNTOVF         0xda0
> > +
> >  #define CSR_SSTATUS            0x100
> >  #define CSR_SIE                        0x104
> >  #define CSR_STVEC              0x105
> > @@ -212,7 +215,10 @@
> >  # define RV_IRQ_SOFT           IRQ_S_SOFT
> >  # define RV_IRQ_TIMER  IRQ_S_TIMER
> >  # define RV_IRQ_EXT            IRQ_S_EXT
> > -#endif /* CONFIG_RISCV_M_MODE */
> > +# define RV_IRQ_PMU    IRQ_PMU_OVF
> > +# define SIP_LCOFIP     (_AC(0x1, UL) << IRQ_PMU_OVF)
> > +
> > +#endif /* !CONFIG_RISCV_M_MODE */
> >
> >  /* IE/IP (Supervisor/Machine Interrupt Enable/Pending) flags */
> >  #define IE_SIE         (_AC(0x1, UL) << RV_IRQ_SOFT)
> > diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h
> > index 368ab0f330c8..417e0840647a 100644
> > --- a/arch/riscv/include/asm/hwcap.h
> > +++ b/arch/riscv/include/asm/hwcap.h
> > @@ -50,6 +50,7 @@ extern unsigned long elf_hwcap;
> >   * available logical extension id.
> >   */
> >  enum riscv_isa_ext_id {
> > +       RISCV_ISA_EXT_SSCOFPMF = RISCV_ISA_EXT_BASE,
> >         RISCV_ISA_EXT_ID_MAX = RISCV_ISA_EXT_MAX,
> >  };
> >
> > diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
> > index c70eeec17f5b..3eedfb9ecd48 100644
> > --- a/arch/riscv/kernel/cpufeature.c
> > +++ b/arch/riscv/kernel/cpufeature.c
> > @@ -71,6 +71,7 @@ EXPORT_SYMBOL_GPL(__riscv_isa_extension_available);
> >         }
> >
> >  static struct riscv_isa_ext_data isa_ext_arr[] = {
> > +       __RISCV_ISA_EXT_DATA(sscofpmf, sscofpmf, RISCV_ISA_EXT_SSCOFPMF),
> >         __RISCV_ISA_EXT_DATA("", "", RISCV_ISA_EXT_MAX),
> >  };
> >
> > diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c
> > index f078d423a89a..ff8692ac43a5 100644
> > --- a/drivers/perf/riscv_pmu_sbi.c
> > +++ b/drivers/perf/riscv_pmu_sbi.c
> > @@ -11,8 +11,13 @@
> >  #include <linux/mod_devicetable.h>
> >  #include <linux/perf/riscv_pmu.h>
> >  #include <linux/platform_device.h>
> > +#include <linux/irq.h>
> > +#include <linux/irqdomain.h>
> > +#include <linux/of_irq.h>
> > +#include <linux/of.h>
> >
> >  #include <asm/sbi.h>
> > +#include <asm/hwcap.h>
> >
> >  union sbi_pmu_ctr_info {
> >         unsigned long value;
> > @@ -33,6 +38,7 @@ union sbi_pmu_ctr_info {
> >   * per_cpu in case of harts with different pmu counters
> >   */
> >  static union sbi_pmu_ctr_info *pmu_ctr_list;
> > +static unsigned int riscv_pmu_irq;
> >
> >  struct pmu_event_data {
> >         union {
> > @@ -450,33 +456,223 @@ static int pmu_sbi_get_ctrinfo(int nctr)
> >         return 0;
> >  }
> >
> > +static inline void pmu_sbi_stop_all(struct riscv_pmu *pmu)
> > +{
> > +       int idx = 0;
> > +       struct cpu_hw_events *cpu_hw_evt = this_cpu_ptr(pmu->hw_events);
> > +       unsigned long cmask = 0;
> > +       union sbi_pmu_ctr_info *info;
> > +
> > +       /* We should only stop the used hardware counters */
> > +       for_each_set_bit(idx, cpu_hw_evt->used_event_ctrs, RISCV_MAX_COUNTERS) {
> > +               info = &pmu_ctr_list[idx];
> > +               if (info->type != SBI_PMU_CTR_TYPE_FW)
> > +                       cmask |= (1 << idx);
> > +       }
> > +       /* No need to check the error here as we can't do anything about the error */
> > +       sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_STOP, 0, cmask, 0, 0, 0, 0);
> > +}
> > +
> > +/**
> > + * This function starts all the used counters in two step approach.
> > + * Any counter that did not overflow can be start in a single step
> > + * while the overflowed counters need to be started with updated initialization
> > + * value.
> > + */
> > +static inline void pmu_sbi_start_overflow_mask(struct riscv_pmu *pmu,
> > +                                              unsigned long ctr_ovf_mask)
> > +{
> > +       int idx = 0;
> > +       struct cpu_hw_events *cpu_hw_evt = this_cpu_ptr(pmu->hw_events);
> > +       struct perf_event *event;
> > +       unsigned long flag = SBI_PMU_START_FLAG_SET_INIT_VALUE;
> > +       unsigned long ctr_start_mask = 0;
> > +       uint64_t max_period;
> > +       struct hw_perf_event *hwc;
> > +       u64 init_val = 0;
> > +
> > +       ctr_start_mask = cpu_hw_evt->used_event_ctrs[0] & ~ctr_ovf_mask;
> > +
> > +       /* Start all the counters that did not overflow in a single shot */
> > +       sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_START, 0, ctr_start_mask,
> > +                 0, 0, 0, 0);
> > +
> > +       /* Reinitialize and start all the counter that overflowed */
> > +       while (ctr_ovf_mask) {
> > +               if (ctr_ovf_mask & 0x01) {
> > +                       event = cpu_hw_evt->events[idx];
> > +                       hwc = &event->hw;
> > +                       max_period = riscv_pmu_ctr_get_width_mask(event);
> > +                       init_val = local64_read(&hwc->prev_count) & max_period;
> > +                       sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_START, idx, 1,
> > +                                 flag, init_val, 0, 0);
> > +               }
> > +               ctr_ovf_mask = ctr_ovf_mask >> 1;
> > +               idx++;
> > +       }
> > +}
> > +
> > +static irqreturn_t pmu_sbi_ovf_handler(int irq, void *dev)
> > +{
> > +       struct perf_sample_data data;
> > +       struct pt_regs *regs;
> > +       struct hw_perf_event *hw_evt;
> > +       union sbi_pmu_ctr_info *info;
> > +       int lidx, hidx, fidx;
> > +       struct riscv_pmu *pmu;
> > +       struct perf_event *event;
> > +       struct cpu_hw_events *cpu_hw_evt = dev;
> > +       unsigned long overflow;
> > +       unsigned long overflowed_ctrs = 0;
> > +
> > +       fidx = find_first_bit(cpu_hw_evt->used_event_ctrs, RISCV_MAX_COUNTERS);
> > +       event = cpu_hw_evt->events[fidx];
> > +       if (!event) {
> > +               csr_clear(CSR_SIP, SIP_LCOFIP);
> > +               return IRQ_NONE;
> > +       }
> > +
> > +       pmu = to_riscv_pmu(event->pmu);
> > +       pmu_sbi_stop_all(pmu);
> > +
> > +       /* Overflow status register should only be read after counter are stopped */
> > +       overflow = csr_read(CSR_SSCOUNTOVF);
> > +
> > +       /**
> > +        * Overflow interrupt pending bit should only be cleared after stopping
> > +        * all the counters to avoid any race condition.
> > +        */
> > +       csr_clear(CSR_SIP, SIP_LCOFIP);
> > +
> > +       /* No overflow bit is set */
> > +       if (!overflow)
> > +               return IRQ_NONE;
> > +
> > +       regs = get_irq_regs();
> > +
> > +       for_each_set_bit(lidx, cpu_hw_evt->used_event_ctrs, RISCV_MAX_COUNTERS) {
> > +               struct perf_event *event = cpu_hw_evt->events[lidx];
> > +
> > +               /* Skip if invalid event or user did not request a sampling */
> > +               if (!event || !is_sampling_event(event))
> > +                       continue;
> > +
> > +               info = &pmu_ctr_list[lidx];
> > +               /* Firmware counter don't support overflow yet */
> > +               if (!info || info->type == SBI_PMU_CTR_TYPE_FW)
> > +                       continue;
> > +
> > +               /* compute hardware counter index */
> > +               hidx = info->csr - CSR_CYCLE;
> > +               /* check if the corresponding bit is set in sscountovf */
> > +               if (!(overflow & (1 << hidx)))
> > +                       continue;
> > +
> > +               /*
> > +                * Keep a track of overflowed counters so that they can be started
> > +                * with updated initial value.
> > +                */
> > +               overflowed_ctrs |= 1 << lidx;
> > +               hw_evt = &event->hw;
> > +               riscv_pmu_event_update(event);
> > +               perf_sample_data_init(&data, 0, hw_evt->last_period);
> > +               if (riscv_pmu_event_set_period(event)) {
> > +                       /*
> > +                        * Unlike other ISAs, RISC-V don't have to disable interrupts
> > +                        * to avoid throttling here. As per the specification, the
> > +                        * interrupt remains disabled until the OF bit is set.
> > +                        * Interrupts are enabled again only during the start.
> > +                        * TODO: We will need to stop the guest counters once
> > +                        * virtualization support is added.
> > +                        */
> > +                       perf_event_overflow(event, &data, regs);
> > +               }
> > +       }
> > +       pmu_sbi_start_overflow_mask(pmu, overflowed_ctrs);
> > +
> > +       return IRQ_HANDLED;
> > +}
> > +
> >  static int pmu_sbi_starting_cpu(unsigned int cpu, struct hlist_node *node)
> >  {
> >         struct riscv_pmu *pmu = hlist_entry_safe(node, struct riscv_pmu, node);
> > +       struct cpu_hw_events __percpu *hw_events = pmu->hw_events;
> >
> >         /* Enable the access for TIME csr only from the user mode now */
> >         csr_write(CSR_SCOUNTEREN, 0x2);
> >
> >         /* Stop all the counters so that they can be enabled from perf */
> > -       sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_STOP,
> > -                 0, GENMASK_ULL(pmu->num_counters - 1, 0), 0, 0, 0, 0);
> > +       pmu_sbi_stop_all(pmu);
> > +
> > +       if (riscv_isa_extension_available(NULL, SSCOFPMF)) {
> > +               hw_events->irq = riscv_pmu_irq;
>
> As I understand hw_events points to a per_cpu data, I think we should
> use per_cpu(hw_events->irq, cpu) to store per cpu data.
>

Thanks for catching it. Fixed it.

> Thanks.
> Eric Lin
>
> > +               csr_clear(CSR_IP, BIT(RV_IRQ_PMU));
> > +               csr_set(CSR_IE, BIT(RV_IRQ_PMU));
> > +               enable_percpu_irq(riscv_pmu_irq, IRQ_TYPE_NONE);
> > +       }
> >
> >         return 0;
> >  }
> >
> >  static int pmu_sbi_dying_cpu(unsigned int cpu, struct hlist_node *node)
> >  {
> > +       if (riscv_isa_extension_available(NULL, SSCOFPMF)) {
> > +               disable_percpu_irq(riscv_pmu_irq);
> > +               csr_clear(CSR_IE, BIT(RV_IRQ_PMU));
> > +       }
> > +
> >         /* Disable all counters access for user mode now */
> >         csr_write(CSR_SCOUNTEREN, 0x0);
> >
> >         return 0;
> >  }
> >
> > +static int pmu_sbi_setup_irqs(struct riscv_pmu *pmu, struct platform_device *pdev)
> > +{
> > +       int ret;
> > +       struct cpu_hw_events __percpu *hw_events = pmu->hw_events;
> > +       struct device_node *cpu, *child;
> > +       struct irq_domain *domain = NULL;
> > +
> > +       if (!riscv_isa_extension_available(NULL, SSCOFPMF))
> > +               return -EOPNOTSUPP;
> > +
> > +       for_each_of_cpu_node(cpu) {
> > +               child = of_get_compatible_child(cpu, "riscv,cpu-intc");
> > +               if (!child) {
> > +                       pr_err("Failed to find INTC node\n");
> > +                       return -ENODEV;
> > +               }
> > +               domain = irq_find_host(child);
> > +               of_node_put(child);
> > +               if (domain)
> > +                       break;
> > +       }
> > +       if (!domain) {
> > +               pr_err("Failed to find INTC IRQ root domain\n");
> > +               return -ENODEV;
> > +       }
> > +
> > +       riscv_pmu_irq = irq_create_mapping(domain, RV_IRQ_PMU);
> > +       if (!riscv_pmu_irq) {
> > +               pr_err("Failed to map PMU interrupt for node\n");
> > +               return -ENODEV;
> > +       }
> > +
> > +       ret = request_percpu_irq(riscv_pmu_irq, pmu_sbi_ovf_handler, "riscv-pmu", hw_events);
> > +       if (ret) {
> > +               pr_err("registering percpu irq failed [%d]\n", ret);
> > +               return ret;
> > +       }
> > +
> > +       return 0;
> > +}
> > +
> >  static int pmu_sbi_device_probe(struct platform_device *pdev)
> >  {
> >         struct riscv_pmu *pmu = NULL;
> >         int num_counters;
> > -       int ret;
> > +       int ret = -ENODEV;
> >
> >         pr_info("SBI PMU extension is available\n");
> >         /* Notify legacy implementation that SBI pmu is available*/
> > @@ -488,13 +684,19 @@ static int pmu_sbi_device_probe(struct platform_device *pdev)
> >         num_counters = pmu_sbi_find_num_ctrs();
> >         if (num_counters < 0) {
> >                 pr_err("SBI PMU extension doesn't provide any counters\n");
> > -               return -ENODEV;
> > +               goto out_free;
> >         }
> >
> >         /* cache all the information about counters now */
> >         if (pmu_sbi_get_ctrinfo(num_counters))
> > -               return -ENODEV;
> > +               goto out_free;
> >
> > +       ret = pmu_sbi_setup_irqs(pmu, pdev);
> > +       if (ret < 0) {
> > +               pr_info("Perf sampling/filtering is not supported as sscof extension is not available\n");
> > +               pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
> > +               pmu->pmu.capabilities |= PERF_PMU_CAP_NO_EXCLUDE;
> > +       }
> >         pmu->num_counters = num_counters;
> >         pmu->ctr_start = pmu_sbi_ctr_start;
> >         pmu->ctr_stop = pmu_sbi_ctr_stop;
> > @@ -515,6 +717,10 @@ static int pmu_sbi_device_probe(struct platform_device *pdev)
> >         }
> >
> >         return 0;
> > +
> > +out_free:
> > +       kfree(pmu);
> > +       return ret;
> >  }
> >
> >  static struct platform_driver pmu_sbi_driver = {
> > @@ -544,8 +750,6 @@ static int __init pmu_sbi_devinit(void)
> >         }
> >
> >         ret = platform_driver_register(&pmu_sbi_driver);
> > -       if (ret)
> > -               return ret;
> >
> >         pdev = platform_device_register_simple(RISCV_PMU_PDEV_NAME, -1, NULL, 0);
> >         if (IS_ERR(pdev)) {
> > diff --git a/include/linux/perf/riscv_pmu.h b/include/linux/perf/riscv_pmu.h
> > index 52672de540c2..c7e2d689063a 100644
> > --- a/include/linux/perf/riscv_pmu.h
> > +++ b/include/linux/perf/riscv_pmu.h
> > @@ -29,6 +29,8 @@
> >  struct cpu_hw_events {
> >         /* currently enabled events */
> >         int                     n_events;
> > +       /* Counter overflow interrupt */
> > +       int             irq;
> >         /* currently enabled events */
> >         struct perf_event       *events[RISCV_MAX_COUNTERS];
> >         /* currently enabled counters */
> > --
> > 2.33.1
> >
> >
> > _______________________________________________
> > linux-riscv mailing list
> > linux-riscv@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-riscv
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv



-- 
Regards,
Atish

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

^ permalink raw reply

* [ndctl PATCH v3 04/16] ndctl/test: Initialize the label area by default
From: Dan Williams @ 2022-01-05 21:32 UTC (permalink / raw)
  To: vishal.l.verma; +Cc: nvdimm, linux-cxl
In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com>

The removal of BLK-mode support causes nfit_test regions to not be
'aliased' by default, which means that the only way to enable labels is to
initialize the namespace label index block. In support of that the common
'reset()' helper is updated to initialize v1.1 labels instead of zero them.
Additionally, it highlighted that some btt tests have silent assumptions of
v1.1 vs v1.2 label support. Add a 'resetV()' alternative to the common
'reset()' function that initializes the label area to v1.2.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/btt-errors.sh     |    4 ++--
 test/btt-pad-compat.sh |    2 +-
 test/common            |   11 +++++++++--
 test/label-compat.sh   |    2 +-
 4 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/test/btt-errors.sh b/test/btt-errors.sh
index 5a20d26fe6d5..6e69178cc3cf 100755
--- a/test/btt-errors.sh
+++ b/test/btt-errors.sh
@@ -45,7 +45,7 @@ trap 'err $LINENO cleanup' ERR
 
 # setup (reset nfit_test dimms)
 modprobe nfit_test
-reset
+resetV
 
 rc=1
 
@@ -124,7 +124,7 @@ dd if=$MNT/$FILE of=/dev/null iflag=direct bs=4096 count=1
 
 # reset everything to get a clean log
 if grep -q "$MNT" /proc/mounts; then umount $MNT; fi
-reset
+resetV
 dev="x"
 json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector)
 eval "$(echo "$json" | json2var)"
diff --git a/test/btt-pad-compat.sh b/test/btt-pad-compat.sh
index be538b761151..005316a205c8 100755
--- a/test/btt-pad-compat.sh
+++ b/test/btt-pad-compat.sh
@@ -148,7 +148,7 @@ do_tests()
 	verify_idx 0 1
 
 	# do the same with an old format namespace
-	reset
+	resetV
 	create_oldfmt_ns
 	verify_idx 0 2
 
diff --git a/test/common b/test/common
index 3c54d633251f..b6d47128f209 100644
--- a/test/common
+++ b/test/common
@@ -49,14 +49,21 @@ err()
 reset()
 {
 	$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-	$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
+	$NDCTL init-labels -f -b $NFIT_TEST_BUS0 all
+	$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+}
+
+resetV()
+{
+	$NDCTL disable-region -b $NFIT_TEST_BUS0 all
+	$NDCTL init-labels -f -V 1.2 -b $NFIT_TEST_BUS0 all
 	$NDCTL enable-region -b $NFIT_TEST_BUS0 all
 }
 
 reset1()
 {
 	$NDCTL disable-region -b $NFIT_TEST_BUS1 all
-	$NDCTL zero-labels -b $NFIT_TEST_BUS1 all
+	$NDCTL init-labels -f -b $NFIT_TEST_BUS1 all
 	$NDCTL enable-region -b $NFIT_TEST_BUS1 all
 }
 
diff --git a/test/label-compat.sh b/test/label-compat.sh
index 8ab285878d84..7ae4d5efd0ff 100755
--- a/test/label-compat.sh
+++ b/test/label-compat.sh
@@ -17,7 +17,7 @@ trap 'err $LINENO' ERR
 # setup (reset nfit_test dimms)
 modprobe nfit_test
 $NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
+$NDCTL init-labels -f -b $NFIT_TEST_BUS0 all
 
 # grab the largest pmem region on -b $NFIT_TEST_BUS0
 query=". | sort_by(.available_size) | reverse | .[0].dev"


^ permalink raw reply related

* [ndctl PATCH v3 03/16] ndctl/test: Move 'reset()' to function in 'common'
From: Dan Williams @ 2022-01-05 21:31 UTC (permalink / raw)
  To: vishal.l.verma; +Cc: nvdimm, linux-cxl
In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com>

When BLK mode is removed, tests that expect the nfit_test region to allow
pmem namespace creation will need to 'init' rather than 'zero' labels. In
preparation, take the time opportunity to move reset() to a common
function. So that 'ndctl zero-labels' can be replaced with 'ndctl
init-labels' in one central location.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/blk-exhaust.sh             |    4 +---
 test/btt-check.sh               |    7 -------
 test/btt-errors.sh              |   12 +++---------
 test/btt-pad-compat.sh          |    7 -------
 test/clear.sh                   |    4 +---
 test/common                     |   15 +++++++++++++++
 test/create.sh                  |    4 +---
 test/daxctl-create.sh           |    4 ++--
 test/daxdev-errors.sh           |    4 +---
 test/firmware-update.sh         |    8 +++-----
 test/inject-error.sh            |    7 -------
 test/max_available_extent_ns.sh |    9 +--------
 test/monitor.sh                 |   11 ++---------
 test/multi-dax.sh               |    4 +---
 test/pfn-meta-errors.sh         |    4 +---
 test/pmem-errors.sh             |    4 +---
 test/rescan-partitions.sh       |    7 -------
 test/sector-mode.sh             |    9 ++-------
 test/track-uuid.sh              |    4 +---
 19 files changed, 36 insertions(+), 92 deletions(-)

diff --git a/test/blk-exhaust.sh b/test/blk-exhaust.sh
index 09c4aae146a6..b6d3808969f1 100755
--- a/test/blk-exhaust.sh
+++ b/test/blk-exhaust.sh
@@ -14,9 +14,7 @@ trap 'err $LINENO' ERR
 
 # setup (reset nfit_test dimms)
 modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+reset
 
 # if the kernel accounting is correct we should be able to create two
 # pmem and two blk namespaces on nfit_test.0
diff --git a/test/btt-check.sh b/test/btt-check.sh
index 8e0b489a8eca..65b5c58bb236 100755
--- a/test/btt-check.sh
+++ b/test/btt-check.sh
@@ -39,13 +39,6 @@ create()
 	[ $size -gt 0 ] || err "$LINENO"
 }
 
-reset()
-{
-	$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-	$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-	$NDCTL enable-region -b $NFIT_TEST_BUS0 all
-}
-
 # re-enable the BTT namespace, and do IO to it in an attempt to
 # verify it still comes up ok, and functions as expected
 post_repair_test()
diff --git a/test/btt-errors.sh b/test/btt-errors.sh
index 4e59f57aea7c..5a20d26fe6d5 100755
--- a/test/btt-errors.sh
+++ b/test/btt-errors.sh
@@ -45,9 +45,7 @@ trap 'err $LINENO cleanup' ERR
 
 # setup (reset nfit_test dimms)
 modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+reset
 
 rc=1
 
@@ -126,9 +124,7 @@ dd if=$MNT/$FILE of=/dev/null iflag=direct bs=4096 count=1
 
 # reset everything to get a clean log
 if grep -q "$MNT" /proc/mounts; then umount $MNT; fi
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+reset
 dev="x"
 json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector)
 eval "$(echo "$json" | json2var)"
@@ -148,9 +144,7 @@ force_raw 0
 dd if=/dev/$blockdev of=/dev/null iflag=direct bs=4096 count=1 && err $LINENO || true
 
 # done, exit
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+reset
 cleanup
 _cleanup
 exit 0
diff --git a/test/btt-pad-compat.sh b/test/btt-pad-compat.sh
index bf1ea54af9d2..be538b761151 100755
--- a/test/btt-pad-compat.sh
+++ b/test/btt-pad-compat.sh
@@ -37,13 +37,6 @@ create()
 	fi
 }
 
-reset()
-{
-	$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-	$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-	$NDCTL enable-region -b $NFIT_TEST_BUS0 all
-}
-
 verify_idx()
 {
 	idx0="$1"
diff --git a/test/clear.sh b/test/clear.sh
index fb9d52c837d4..c4d02d54714d 100755
--- a/test/clear.sh
+++ b/test/clear.sh
@@ -14,9 +14,7 @@ trap 'err $LINENO' ERR
 
 # setup (reset nfit_test dimms)
 modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+reset
 
 rc=1
 
diff --git a/test/common b/test/common
index 6bcefcad9bf9..3c54d633251f 100644
--- a/test/common
+++ b/test/common
@@ -46,6 +46,21 @@ err()
 	exit $rc
 }
 
+reset()
+{
+	$NDCTL disable-region -b $NFIT_TEST_BUS0 all
+	$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
+	$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+}
+
+reset1()
+{
+	$NDCTL disable-region -b $NFIT_TEST_BUS1 all
+	$NDCTL zero-labels -b $NFIT_TEST_BUS1 all
+	$NDCTL enable-region -b $NFIT_TEST_BUS1 all
+}
+
+
 # check_min_kver
 # $1: Supported kernel version. format: X.Y
 #
diff --git a/test/create.sh b/test/create.sh
index b0fd99f1e7b1..e9baaa075a28 100755
--- a/test/create.sh
+++ b/test/create.sh
@@ -15,9 +15,7 @@ trap 'err $LINENO' ERR
 
 # setup (reset nfit_test dimms)
 modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+reset
 
 rc=1
 
diff --git a/test/daxctl-create.sh b/test/daxctl-create.sh
index 198779a851b4..d319a3939ac5 100755
--- a/test/daxctl-create.sh
+++ b/test/daxctl-create.sh
@@ -10,7 +10,7 @@ trap 'cleanup $LINENO' ERR
 cleanup()
 {
 	printf "Error at line %d\n" "$1"
-	[[ $testdev ]] && reset
+	[[ $testdev ]] && reset_dax
 	exit $rc
 }
 
@@ -70,7 +70,7 @@ reset_dev()
 	"$DAXCTL" enable-device "$testdev"
 }
 
-reset()
+reset_dax()
 {
 	test -n "$testdev"
 
diff --git a/test/daxdev-errors.sh b/test/daxdev-errors.sh
index 9547d781162b..e13453dfaa73 100755
--- a/test/daxdev-errors.sh
+++ b/test/daxdev-errors.sh
@@ -15,9 +15,7 @@ trap 'err $LINENO' ERR
 
 # setup (reset nfit_test dimms)
 modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+reset
 
 rc=1
 
diff --git a/test/firmware-update.sh b/test/firmware-update.sh
index 8cc9c41b57ca..93ce166e6255 100755
--- a/test/firmware-update.sh
+++ b/test/firmware-update.sh
@@ -10,11 +10,9 @@ image="update-fw.img"
 
 trap 'err $LINENO' ERR
 
-reset()
+fwupd_reset()
 {
-	$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-	$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-	$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+	reset
 	if [ -f $image ]; then
 		rm -f $image
 	fi
@@ -73,7 +71,7 @@ do_tests()
 check_min_kver "4.16" || do_skip "may lack firmware update test handling"
 
 modprobe nfit_test
-reset
+fwupd_reset
 detect
 rc=1
 do_tests
diff --git a/test/inject-error.sh b/test/inject-error.sh
index 7d0b8269f5db..fd823b6cfa13 100755
--- a/test/inject-error.sh
+++ b/test/inject-error.sh
@@ -37,13 +37,6 @@ create()
 	[ $size -gt 0 ] || err "$LINENO"
 }
 
-reset()
-{
-	$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-	$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-	$NDCTL enable-region -b $NFIT_TEST_BUS0 all
-}
-
 check_status()
 {
 	local sector="$1"
diff --git a/test/max_available_extent_ns.sh b/test/max_available_extent_ns.sh
index 343f3c9eac49..47a921f5edf2 100755
--- a/test/max_available_extent_ns.sh
+++ b/test/max_available_extent_ns.sh
@@ -11,13 +11,6 @@ trap 'err $LINENO' ERR
 check_min_kver "4.19" || do_skip "kernel $KVER may not support max_available_size"
 check_prereq "jq"
 
-init()
-{
-	$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-	$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-	$NDCTL enable-region -b $NFIT_TEST_BUS0 all
-}
-
 do_test()
 {
 	region=$($NDCTL list -b $NFIT_TEST_BUS0 -R -t pmem | jq -r 'sort_by(-.size) | .[].dev' | head -1)
@@ -40,7 +33,7 @@ do_test()
 
 modprobe nfit_test
 rc=1
-init
+reset
 do_test
 _cleanup
 exit 0
diff --git a/test/monitor.sh b/test/monitor.sh
index 28c55415c819..14450a7b23e3 100755
--- a/test/monitor.sh
+++ b/test/monitor.sh
@@ -19,13 +19,6 @@ trap 'err $LINENO' ERR
 
 check_min_kver "4.15" || do_skip "kernel $KVER may not support monitor service"
 
-init()
-{
-	$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-	$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-	$NDCTL enable-region -b $NFIT_TEST_BUS0 all
-}
-
 start_monitor()
 {
 	logfile=$(mktemp)
@@ -112,7 +105,7 @@ test_filter_region()
 
 test_filter_namespace()
 {
-	init
+	reset
 	monitor_namespace=$($NDCTL create-namespace -b $smart_supported_bus | jq -r .dev)
 	monitor_dimms=$(get_monitor_dimm "-n $monitor_namespace")
 	start_monitor "-n $monitor_namespace"
@@ -170,7 +163,7 @@ do_tests()
 
 modprobe nfit_test
 rc=1
-init
+reset
 set_smart_supported_bus
 do_tests
 _cleanup
diff --git a/test/multi-dax.sh b/test/multi-dax.sh
index b343a3869f9c..04070adb18e4 100755
--- a/test/multi-dax.sh
+++ b/test/multi-dax.sh
@@ -17,9 +17,7 @@ ALIGN_SIZE=`getconf PAGESIZE`
 
 # setup (reset nfit_test dimms)
 modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+reset
 rc=1
 
 query=". | sort_by(.available_size) | reverse | .[0].dev"
diff --git a/test/pfn-meta-errors.sh b/test/pfn-meta-errors.sh
index 0ade2e52a8ad..631489797087 100755
--- a/test/pfn-meta-errors.sh
+++ b/test/pfn-meta-errors.sh
@@ -29,9 +29,7 @@ trap 'err $LINENO' ERR
 
 # setup (reset nfit_test dimms)
 modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+reset
 
 rc=1
 
diff --git a/test/pmem-errors.sh b/test/pmem-errors.sh
index 4225c3bce0c7..20657801fc0e 100755
--- a/test/pmem-errors.sh
+++ b/test/pmem-errors.sh
@@ -28,9 +28,7 @@ trap 'err $LINENO cleanup' ERR
 
 # setup (reset nfit_test dimms)
 modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+reset
 
 rc=1
 
diff --git a/test/rescan-partitions.sh b/test/rescan-partitions.sh
index 1686de3552f1..51bbd731fb55 100755
--- a/test/rescan-partitions.sh
+++ b/test/rescan-partitions.sh
@@ -25,13 +25,6 @@ check_min_kver "4.16" || do_skip "may not contain fixes for partition rescanning
 check_prereq "parted"
 check_prereq "blockdev"
 
-reset()
-{
-	$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-	$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-	$NDCTL enable-region -b $NFIT_TEST_BUS0 all
-}
-
 test_mode()
 {
 	local mode="$1"
diff --git a/test/sector-mode.sh b/test/sector-mode.sh
index 7a2faeae8a2d..439ef331adaf 100755
--- a/test/sector-mode.sh
+++ b/test/sector-mode.sh
@@ -15,13 +15,8 @@ ALIGN_SIZE=`getconf PAGESIZE`
 
 # setup (reset nfit_test dimms)
 modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
-
-$NDCTL disable-region -b $NFIT_TEST_BUS1 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS1 all
-$NDCTL enable-region -b $NFIT_TEST_BUS1 all
+reset
+reset1
 
 rc=1
 query=". | sort_by(.size) | reverse | .[0].dev"
diff --git a/test/track-uuid.sh b/test/track-uuid.sh
index be3cf9c07a0a..3bacd2c24787 100755
--- a/test/track-uuid.sh
+++ b/test/track-uuid.sh
@@ -12,9 +12,7 @@ trap 'err $LINENO' ERR
 
 # setup (reset nfit_test dimms)
 modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+reset
 
 rc=1
 


^ permalink raw reply related

* [OpenRISC] [PATCH v5 00/13] Glibc OpenRISC port - PUSHED
From: Stafford Horne @ 2022-01-05 21:34 UTC (permalink / raw)
  To: openrisc
In-Reply-To: <YdS92XAL/U+57Qfx@antec>

Thank you.

On Wed, Jan 05, 2022 at 06:36:25AM +0900, Stafford Horne wrote:
> On Tue, Jan 04, 2022 at 09:34:47AM -0300, Adhemerval Zanella wrote:
> > 
> > 
> > On 04/01/2022 00:14, Stafford Horne via Libc-alpha wrote:
> > > This is the OpenRISC port for glibc that I have been working on.
> > > 
> > > Changes since v4:
> > >  - Fix suggestion from Joseph Myers
> > >    - Remove libnsl.abilist
> > >  - Fixed suggestions from Adhemerval:
> > >    - Use Elf32_Addr and Elf32_Sym on link.h and sotruss-lib.c.
> > >    - Remove the superflous atomic typedefs on atomic-machine.h.
> > >    - Add the _dl_find_object on libc.abilist.
> > >    - Update wording for the NEWS entry.
> > >  - Other fixes
> > >    - Update date to 2022
> > >    - Remove uneeded REGSIZE
> > >    - Remove trailing newlines in Makefile
> > >    - Fix space vs tabs indentation in sysdep.h
> > > 
> > > Changes since v3:
> > >  - Fix suggestion from Paul Eggert
> > >    - Fix typo pore/port
> > >  - Fixed suggestions from Adhemerval:
> > >    - Used ENTRY/END asm macros where missing
> > >    - Remove block in dl-machine.h suggesting LD_PROFILE
> > >    - Remove jmp_buf-macros.h  macros and use new default.
> > >    - Remove tcb-offsets.sym file and Makefile reference.
> > >    - Remove tcb-offsets.h include in tls.h.
> > >    - Define lib-audit register layout inline with other architectures.
> > >    - Fix usage of locally defined register in or1k_get_got.  Also, fixup
> > >      indentation when using or1k_get_got.
> > >    - Cleanup abilists after rebasing, adding rseq and removing
> > >      empty files.
> > >    - Remove prctl and other unused entries in the linux Makefile.
> > >    - Fix STACK_ALIGN to 4 bytes, from incorrect copy-n-paste 16 bytes.
> > >    - Use default pthreadtypes-arch.h.
> > >    - Mention only soft-float supported in NEWS.
> > >    - Remove sysdeps/unix/sysv/linux/or1k/bits/timesize.h and use new
> > >      default.
> > > 
> > > Changes since v2:
> > >  - Fixed suggestions from Joseph Myers:
> > >    - Fix comment style, and description on top of each file
> > >    - Make sure macros have parentheses when needed,
> > >    - Bump required kernel down to 5.4.0 and document
> > >    - Regenerate arch-syscall.h
> > >  - Fixed suggestions from Adhemerval:
> > >    - Remove kernel_stat.h
> > >    - Just set MMAP2_PAGE_UNIT to 8K
> > >    - Remove ioctl.c and syscall.c files
> > >  - Update TCB alignment to 32 bytes
> > > 
> > > Changes since v1:
> > >  - Update api's as suggested by Florian
> > >  - Remove hard float support
> > >  - Updates to get all tests passing
> > >  - Split patch into managable bits similar to recent ARC port
> > > 
> > > Documentation:
> > > 
> > >   Architecture / ABI docs:
> > >    https://raw.githubusercontent.com/openrisc/doc/master/openrisc-arch-1.3-rev1.pdf
> > > 
> > > Test Results:
> > > 
> > >   build-many-glibcs.py:
> > > 
> > >    PASS with mainline ang gcc-11.
> > > 
> > >   Full test suite:
> > > 
> > >   This time I ran the test suite with timeout of 300 and with patch for forcing
> > >   O_LARGEFILE in open64 [0].  The test has one failure but it seems like flaky
> > >   test as it passed after the second run.
> > This is already approved, so I take these tests were done against and slight order
> > tree (which is fine btw).
> 
> Sorry, I forgot to update this bit for v5.  The patch for open64 is already
> upstream.
> 
> > > 
> > >     # results in file: /home/shorne/work/gnu-toolchain/log/test--20211226-162029.log
> > >     # test start:    2021-12-26T16:20:29+09:00
> > > 
> > >     # failures
> > >     FAIL: posix/tst-execveat   /* Running second time passes */
> > > 
> > >     # test finish:   2021-12-29T12:54:08+09:00
> > >     # test duration: 2 days 20 hours 33 minutes and 39 seconds
> > >     # test for file: tests.sum
> > >     # test wrapper:  /home/shorne/work/gnu-toolchain/glibc/scripts/cross-test-ssh.sh --timeoutfactor 300 10.0.0.5
> > > 
> > >     # summary
> > > 	  1 FAIL
> > >        4148 PASS
> > > 	 31 UNSUPPORTED
> > > 	 16 XFAIL
> > > 	  2 XPASS
> > > 
> > >     posix/tst-execveat.out:
> > > 	Timed out: killed the child process
> > > 	Termination time: 2021-12-29T01:02:42.433964340
> > > 	Last write to standard output: 2021-12-28T23:22:40.266363000
> > > 
> > >     tests.sum: https://gist.github.com/stffrdhrn/88c1fce0c54350258f1f5869068d015a
> > > 
> > >  [0] https://sourceware.org/pipermail/libc-alpha/2021-December/134634.html
> > > 
> > 
> > I approved the missing patch and I think the patches are ok to go in.  I am
> > curious about the posix/tst-execveat issues, but since it does not really 
> > have any arch-specific implementation I think it might be related to the
> > test environment (it would be good to know exactly what has caused the
> > failure so we can improve it).
> 
> It fails with what looks like a deadlock but I cannot reproduce it.  When it
> fails it times our after several minutes, when I run it again it passes right
> away.
> 
> The platform I run on loads binaries over NFS.  There may be some kind of race
> condition caused when binaries are loading slowly.
> 
> I will wait a day or so for comments then push this upstream.  If no objections,
> thanks for all your help reviewing.  Note, after pushing up stream I will also
> publish all of the updates to the glibc wiki.
> 
> -Stafford

^ permalink raw reply

* Re: [PATCH v2 24/30] KVM: x86/mmu: Allow yielding when zapping GFNs for defunct TDP MMU root
From: Sean Christopherson @ 2022-01-05 21:32 UTC (permalink / raw)
  To: David Matlack
  Cc: Paolo Bonzini, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, kvm, linux-kernel, Ben Gardon, Mingwei Zhang
In-Reply-To: <YdTzkjOi2w+MVA2V@google.com>

On Wed, Jan 05, 2022, David Matlack wrote:
> On Thu, Dec 23, 2021 at 10:23:12PM +0000, Sean Christopherson wrote:
> > +	/*
> > +	 * Invalidate the root to prevent it from being reused by a vCPU, and
> > +	 * mark it defunct so that kvm_tdp_mmu_zap_invalidated_roots() doesn't
> > +	 * try to put a reference it didn't acquire.
> > +	 */
> > +	root->role.invalid = true;
> > +	root->tdp_mmu_defunct_root = true;
> 
> Ah ok so tdp_mmu_defunct_root indicates the root became invalid due to
> losing all its references while it was valid. This is in contrast to
> kvm_tdp_mmu_invalidate_all_roots() which marks roots invalid while they
> still have valid references.
> 
> But I wonder if tdp_mmu_defunct_root is necessary? It's only used to
> skip a put in zap_invalidated_roots. Could we instead unconditionally
> grab a reference in invalidate_all_roots and then unconditionally drop
> it?

Hmm, it's probably not necessary.  I added tdp_mmu_defunct_root before realizing
that that kvm_tdp_mmu_invalidate_all_roots() was wrong about this:

 * Roots which have a zero refcount should be skipped as
 * they're already being torn down.

IIRC, I added the second flag because I was trying to honor that (incorrect) logic,
and never reconsidered the need for a second flag once I got everything working.
The only downside would be keeping the memory for defunct roots around a wee bit
longer, and that's not a big deal.

I'll yank it out for the next version, assuming I didn't forget some detail...

^ permalink raw reply

* [ndctl PATCH v3 16/16] ndctl: Jettison autotools
From: Dan Williams @ 2022-01-05 21:33 UTC (permalink / raw)
  To: vishal.l.verma; +Cc: nvdimm, linux-cxl
In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com>

Similar to several other projects, ndctl has run its course with autotools
and sees a better path forward with Meson. Now that the Meson conversion is
complete, remove the autotools infrastructure.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 .gitignore                        |   58 --------
 Documentation/cxl/Makefile.am     |   61 --------
 Documentation/cxl/lib/Makefile.am |   58 --------
 Documentation/daxctl/Makefile.am  |   72 ----------
 Documentation/ndctl/Makefile.am   |  103 --------------
 Makefile.am                       |  104 --------------
 Makefile.am.in                    |   46 ------
 autogen.sh                        |   28 ----
 configure.ac                      |  270 -------------------------------------
 cxl/Makefile.am                   |   25 ---
 cxl/lib/Makefile.am               |   32 ----
 daxctl/Makefile.am                |   45 ------
 daxctl/lib/Makefile.am            |   42 ------
 ndctl.spec.in                     |   28 ----
 ndctl/Makefile.am                 |   86 ------------
 ndctl/lib/Makefile.am             |   58 --------
 rhel/meson.build                  |    3 
 sles/meson.build                  |    3 
 test/Makefile.am                  |  169 -----------------------
 19 files changed, 4 insertions(+), 1287 deletions(-)
 delete mode 100644 Documentation/cxl/Makefile.am
 delete mode 100644 Documentation/cxl/lib/Makefile.am
 delete mode 100644 Documentation/daxctl/Makefile.am
 delete mode 100644 Documentation/ndctl/Makefile.am
 delete mode 100644 Makefile.am
 delete mode 100644 Makefile.am.in
 delete mode 100755 autogen.sh
 delete mode 100644 configure.ac
 delete mode 100644 cxl/Makefile.am
 delete mode 100644 cxl/lib/Makefile.am
 delete mode 100644 daxctl/Makefile.am
 delete mode 100644 daxctl/lib/Makefile.am
 delete mode 100644 ndctl/Makefile.am
 delete mode 100644 ndctl/lib/Makefile.am
 delete mode 100644 test/Makefile.am

diff --git a/.gitignore b/.gitignore
index df8245dc10d8..aa0ce8e400c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,63 +1,5 @@
-*.o
-*.lo
-*.xml
-.deps/
-.libs/
-Makefile
-!contrib/Makefile
-Makefile.in
-/aclocal.m4
-/autom4te.cache
-/build-aux
-/config.h
-/config.log
-/config.status
-/configure
-/libtool
-/stamp-h1
-*.1
-*.3
-Documentation/daxctl/asciidoc.conf
-Documentation/ndctl/asciidoc.conf
-Documentation/cxl/asciidoc.conf
-Documentation/cxl/lib/asciidoc.conf
-Documentation/daxctl/asciidoctor-extensions.rb
-Documentation/ndctl/asciidoctor-extensions.rb
-Documentation/cxl/asciidoctor-extensions.rb
-Documentation/cxl/lib/asciidoctor-extensions.rb
-.dirstamp
 build/
-daxctl/config.h
-daxctl/daxctl
-daxctl/lib/libdaxctl.la
-daxctl/lib/libdaxctl.pc
-*.a
-ndctl/config.h
-ndctl/lib/libndctl.pc
-ndctl/ndctl
 rhel/ndctl.spec
 sles/ndctl.spec
-version.m4
 *.swp
-cscope.files
-cscope*.out
 tags
-test/*.log
-test/*.trs
-test/dax-dev
-test/dax-errors
-test/dax-pmd
-test/daxdev-errors
-test/device-dax
-test/dsm-fail
-test/hugetlb
-test/image
-test/libndctl
-test/mmap
-test/pmem-ns
-test/smart-listen
-test/smart-notify
-test/fio.job
-test/local-write-0-verify.state
-test/ack-shutdown-count-set
-test/list-smart-dimm
diff --git a/Documentation/cxl/Makefile.am b/Documentation/cxl/Makefile.am
deleted file mode 100644
index efabaa37027f..000000000000
--- a/Documentation/cxl/Makefile.am
+++ /dev/null
@@ -1,61 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-# Copyright (C) 2020-2021 Intel Corporation. All rights reserved.
-
-if USE_ASCIIDOCTOR
-
-do_subst = sed -e 's,@Utility@,Cxl,g' -e's,@utility@,cxl,g'
-CONFFILE = asciidoctor-extensions.rb
-asciidoctor-extensions.rb: ../asciidoctor-extensions.rb.in
-	$(AM_V_GEN) $(do_subst) < $< > $@
-
-else
-
-do_subst = sed -e 's,UTILITY,cxl,g'
-CONFFILE = asciidoc.conf
-asciidoc.conf: ../asciidoc.conf.in
-	$(AM_V_GEN) $(do_subst) < $< > $@
-
-endif
-
-man1_MANS = \
-	cxl.1 \
-	cxl-list.1 \
-	cxl-read-labels.1 \
-	cxl-write-labels.1 \
-	cxl-zero-labels.1
-
-EXTRA_DIST = $(man1_MANS)
-
-CLEANFILES = $(man1_MANS)
-
-XML_DEPS = \
-	../../version.m4 \
-	../copyright.txt \
-	Makefile \
-	$(CONFFILE)
-
-RM ?= rm -f
-
-if USE_ASCIIDOCTOR
-
-%.1: %.txt $(XML_DEPS)
-	$(AM_V_GEN)$(RM) $@+ $@ && \
-		$(ASCIIDOC) -b manpage -d manpage -acompat-mode \
-		-I. -rasciidoctor-extensions \
-		-amansource=cxl -amanmanual="cxl Manual" \
-		-andctl_version=$(VERSION) -o $@+ $< && \
-		mv $@+ $@
-
-else
-
-%.xml: %.txt $(XML_DEPS)
-	$(AM_V_GEN)$(RM) $@+ $@ && \
-		$(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
-		--unsafe -acxl_version=$(VERSION) -o $@+ $< && \
-		mv $@+ $@
-
-%.1: %.xml $(XML_DEPS)
-	$(AM_V_GEN)$(RM) $@ && \
-		$(XMLTO) -o . -m ../manpage-normal.xsl man $<
-
-endif
diff --git a/Documentation/cxl/lib/Makefile.am b/Documentation/cxl/lib/Makefile.am
deleted file mode 100644
index 41e3a5fc02b6..000000000000
--- a/Documentation/cxl/lib/Makefile.am
+++ /dev/null
@@ -1,58 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-# Copyright (C) 2020-2021 Intel Corporation. All rights reserved.
-
-if USE_ASCIIDOCTOR
-
-do_subst = sed -e 's,@Utility@,Libcxl,g' -e's,@utility@,libcxl,g'
-CONFFILE = asciidoctor-extensions.rb
-asciidoctor-extensions.rb: ../../asciidoctor-extensions.rb.in
-	$(AM_V_GEN) $(do_subst) < $< > $@
-
-else
-
-do_subst = sed -e 's,UTILITY,libcxl,g'
-CONFFILE = asciidoc.conf
-asciidoc.conf: ../../asciidoc.conf.in
-	$(AM_V_GEN) $(do_subst) < $< > $@
-
-endif
-
-man3_MANS = \
-	libcxl.3 \
-	cxl_new.3
-
-EXTRA_DIST = $(man3_MANS)
-
-CLEANFILES = $(man3_MANS)
-
-XML_DEPS = \
-	../../../version.m4 \
-	../../copyright.txt \
-	Makefile \
-	$(CONFFILE)
-
-RM ?= rm -f
-
-if USE_ASCIIDOCTOR
-
-%.3: %.txt $(XML_DEPS)
-	$(AM_V_GEN)$(RM) $@+ $@ && \
-		$(ASCIIDOC) -b manpage -d manpage -acompat-mode \
-		-I. -rasciidoctor-extensions \
-		-amansource=libcxl -amanmanual="libcxl Manual" \
-		-andctl_version=$(VERSION) -o $@+ $< && \
-		mv $@+ $@
-
-else
-
-%.xml: %.txt $(XML_DEPS)
-	$(AM_V_GEN)$(RM) $@+ $@ && \
-		$(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
-		--unsafe -alibcxl_version=$(VERSION) -o $@+ $< && \
-		mv $@+ $@
-
-%.3: %.xml $(XML_DEPS)
-	$(AM_V_GEN)$(RM) $@ && \
-		$(XMLTO) -o . -m ../../manpage-normal.xsl man $<
-
-endif
diff --git a/Documentation/daxctl/Makefile.am b/Documentation/daxctl/Makefile.am
deleted file mode 100644
index 78c47f5055c4..000000000000
--- a/Documentation/daxctl/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-# Copyright (C) 2015-2020 Intel Corporation. All rights reserved.
-
-if USE_ASCIIDOCTOR
-
-do_subst = sed -e 's,@Utility@,Daxctl,g' -e's,@utility@,daxctl,g'
-CONFFILE = asciidoctor-extensions.rb
-asciidoctor-extensions.rb: ../asciidoctor-extensions.rb.in
-	$(AM_V_GEN) $(do_subst) < $< > $@
-
-else
-
-do_subst = sed -e 's,UTILITY,daxctl,g'
-CONFFILE = asciidoc.conf
-asciidoc.conf: ../asciidoc.conf.in
-	$(AM_V_GEN) $(do_subst) < $< > $@
-
-endif
-
-man1_MANS = \
-	daxctl.1 \
-	daxctl-list.1 \
-	daxctl-migrate-device-model.1 \
-	daxctl-reconfigure-device.1 \
-	daxctl-online-memory.1 \
-	daxctl-offline-memory.1 \
-	daxctl-disable-device.1 \
-	daxctl-enable-device.1 \
-	daxctl-create-device.1 \
-	daxctl-destroy-device.1
-
-EXTRA_DIST = $(man1_MANS)
-
-CLEANFILES = $(man1_MANS)
-
-XML_DEPS = \
-	../../version.m4 \
-	../copyright.txt \
-	Makefile \
-	$(CONFFILE)
-
-RM ?= rm -f
-
-if USE_ASCIIDOCTOR
-
-%.1: %.txt $(XML_DEPS)
-	$(AM_V_GEN)$(RM) $@+ $@ && \
-		$(ASCIIDOC) -b manpage -d manpage -acompat-mode \
-		-I. -rasciidoctor-extensions \
-		-amansource=daxctl -amanmanual="daxctl Manual" \
-		-adaxctl_confdir=$(daxctl_confdir) \
-		-adaxctl_conf=$(daxctl_conf) \
-		-andctl_keysdir=$(ndctl_keysdir) \
-		-andctl_version=$(VERSION) -o $@+ $< && \
-		mv $@+ $@
-
-else
-
-%.xml: %.txt $(XML_DEPS)
-	$(AM_V_GEN)$(RM) $@+ $@ && \
-		$(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
-		-adaxctl_confdir=$(daxctl_confdir) \
-		-adaxctl_conf=$(daxctl_conf) \
-		-andctl_keysdir=$(ndctl_keysdir) \
-		--unsafe -adaxctl_version=$(VERSION) -o $@+ $< && \
-		mv $@+ $@
-
-%.1: %.xml $(XML_DEPS)
-	$(AM_V_GEN)$(RM) $@ && \
-		$(XMLTO) -o . -m ../manpage-normal.xsl man $<
-
-endif
diff --git a/Documentation/ndctl/Makefile.am b/Documentation/ndctl/Makefile.am
deleted file mode 100644
index 203158c1dfaf..000000000000
--- a/Documentation/ndctl/Makefile.am
+++ /dev/null
@@ -1,103 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-# Copyright (C) 2015-2020 Intel Corporation. All rights reserved.
-
-if USE_ASCIIDOCTOR
-
-do_subst = sed -e 's,@Utility@,Ndctl,g' -e's,@utility@,ndctl,g'
-CONFFILE = asciidoctor-extensions.rb
-asciidoctor-extensions.rb: ../asciidoctor-extensions.rb.in
-	$(AM_V_GEN) $(do_subst) < $< > $@
-
-else
-
-do_subst = sed -e 's,UTILITY,ndctl,g'
-CONFFILE = asciidoc.conf
-asciidoc.conf: ../asciidoc.conf.in
-	$(AM_V_GEN) $(do_subst) < $< > $@
-
-endif
-
-man1_MANS = \
-	ndctl.1 \
-	ndctl-wait-scrub.1 \
-	ndctl-start-scrub.1 \
-	ndctl-zero-labels.1 \
-	ndctl-read-labels.1 \
-	ndctl-write-labels.1 \
-	ndctl-init-labels.1 \
-	ndctl-check-labels.1 \
-	ndctl-enable-region.1 \
-	ndctl-disable-region.1 \
-	ndctl-enable-dimm.1 \
-	ndctl-disable-dimm.1 \
-	ndctl-enable-namespace.1 \
-	ndctl-disable-namespace.1 \
-	ndctl-create-namespace.1 \
-	ndctl-destroy-namespace.1 \
-	ndctl-check-namespace.1 \
-	ndctl-clear-errors.1 \
-	ndctl-inject-error.1 \
-	ndctl-inject-smart.1 \
-	ndctl-update-firmware.1 \
-	ndctl-list.1 \
-	ndctl-monitor.1 \
-	ndctl-setup-passphrase.1 \
-	ndctl-update-passphrase.1 \
-	ndctl-remove-passphrase.1 \
-	ndctl-freeze-security.1 \
-	ndctl-sanitize-dimm.1 \
-	ndctl-load-keys.1 \
-	ndctl-wait-overwrite.1 \
-	ndctl-read-infoblock.1 \
-	ndctl-write-infoblock.1 \
-	ndctl-activate-firmware.1
-
-EXTRA_DIST = $(man1_MANS)
-
-CLEANFILES = $(man1_MANS)
-
-XML_DEPS = \
-	../../version.m4 \
-	Makefile \
-	$(CONFFILE) \
-	../copyright.txt \
-	region-description.txt \
-	xable-region-options.txt \
-	dimm-description.txt \
-	xable-dimm-options.txt \
-	xable-namespace-options.txt \
-	ars-description.txt \
-	labels-description.txt \
-	labels-options.txt
-
-RM ?= rm -f
-
-if USE_ASCIIDOCTOR
-
-%.1: %.txt $(XML_DEPS)
-	$(AM_V_GEN)$(RM) $@+ $@ && \
-		$(ASCIIDOC) -b manpage -d manpage -acompat-mode \
-		-I. -rasciidoctor-extensions \
-		-amansource=ndctl -amanmanual="ndctl Manual" \
-		-andctl_confdir=$(ndctl_confdir) \
-		-andctl_monitorconf=$(ndctl_monitorconf) \
-		-andctl_keysdir=$(ndctl_keysdir) \
-		-andctl_version=$(VERSION) -o $@+ $< && \
-		mv $@+ $@
-
-else
-
-%.xml: %.txt $(XML_DEPS)
-	$(AM_V_GEN)$(RM) $@+ $@ && \
-		$(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
-		-andctl_confdir=$(ndctl_confdir) \
-		-andctl_monitorconf=$(ndctl_monitorconf) \
-		-andctl_keysdir=$(ndctl_keysdir) \
-		--unsafe -andctl_version=$(VERSION) -o $@+ $< && \
-		mv $@+ $@
-
-%.1: %.xml $(XML_DEPS)
-	$(AM_V_GEN)$(RM) $@ && \
-		$(XMLTO) -o . -m ../manpage-normal.xsl man $<
-
-endif
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index b78059b0b364..000000000000
--- a/Makefile.am
+++ /dev/null
@@ -1,104 +0,0 @@
-include Makefile.am.in
-
-ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
-SUBDIRS = . cxl/lib daxctl/lib ndctl/lib cxl ndctl daxctl
-if ENABLE_DOCS
-SUBDIRS += Documentation/ndctl Documentation/daxctl Documentation/cxl
-SUBDIRS += Documentation/cxl/lib
-endif
-SUBDIRS += test
-
-BUILT_SOURCES = version.m4
-version.m4: FORCE
-	$(AM_V_GEN)$(top_srcdir)/git-version-gen
-
-FORCE:
-
-EXTRA_DIST += ndctl.spec.in \
-		sles/header \
-		contrib/nvdimm-security.conf
-
-noinst_SCRIPTS = rhel/ndctl.spec sles/ndctl.spec
-CLEANFILES += $(noinst_SCRIPTS)
-
-do_rhel_subst = sed -e 's,VERSION,$(VERSION),g' \
-            -e 's,MESON,0,g' \
-            -e 's,DAX_DNAME,daxctl-devel,g' \
-            -e 's,CXL_DNAME,cxl-devel,g' \
-            -e 's,DNAME,ndctl-devel,g' \
-            -e '/^%defattr.*/d' \
-	    -e 's,DAX_LNAME,daxctl-libs,g' \
-	    -e 's,CXL_LNAME,cxl-libs,g' \
-	    -e 's,LNAME,ndctl-libs,g'
-
-do_sles_subst = sed -e 's,VERSION,$(VERSION),g' \
-            -e 's,MESON,0,g' \
-            -e 's,DAX_DNAME,libdaxctl-devel,g' \
-            -e 's,CXL_DNAME,libcxl-devel,g' \
-            -e 's,DNAME,libndctl-devel,g' \
-            -e 's,%license,%doc,g' \
-            -e 's,\(^License:.*GPL\)v2,\1-2.0,g' \
-            -e "s,DAX_LNAME,libdaxctl$$(($(LIBDAXCTL_CURRENT) - $(LIBDAXCTL_AGE))),g" \
-            -e "s,CXL_LNAME,libcxl$$(($(LIBCXL_CURRENT) - $(LIBCXL_AGE))),g" \
-            -e "s,LNAME,libndctl$$(($(LIBNDCTL_CURRENT) - $(LIBNDCTL_AGE))),g"
-
-rhel/ndctl.spec: ndctl.spec.in Makefile.am version.m4
-	$(AM_V_GEN)$(MKDIR_P) rhel; $(do_rhel_subst) < $< > $@
-
-sles/ndctl.spec: sles/header ndctl.spec.in Makefile.am version.m4
-	$(AM_V_GEN)$(MKDIR_P) sles; cat sles/header $< | $(do_sles_subst) > $@
-
-if ENABLE_BASH_COMPLETION
-bashcompletiondir = $(BASH_COMPLETION_DIR)
-dist_bashcompletion_DATA = contrib/ndctl
-install-data-hook:
-	$(LN_S) -f $(BASH_COMPLETION_DIR)/ndctl $(DESTDIR)/$(BASH_COMPLETION_DIR)/daxctl
-	$(LN_S) -f $(BASH_COMPLETION_DIR)/ndctl $(DESTDIR)/$(BASH_COMPLETION_DIR)/cxl
-endif
-
-modprobe_file = contrib/nvdimm-security.conf
-modprobedir = $(sysconfdir)/modprobe.d/
-modprobe_DATA = $(modprobe_file)
-
-noinst_LIBRARIES = libccan.a
-libccan_a_SOURCES = \
-	ccan/str/str.h \
-	ccan/str/str_debug.h \
-	ccan/str/str.c \
-	ccan/str/debug.c \
-	ccan/list/list.h \
-	ccan/list/list.c \
-	ccan/container_of/container_of.h \
-	ccan/check_type/check_type.h \
-	ccan/build_assert/build_assert.h \
-	ccan/array_size/array_size.h \
-	ccan/minmax/minmax.h \
-	ccan/short_types/short_types.h \
-	ccan/endian/endian.h
-
-noinst_LIBRARIES += libutil.a
-libutil_a_SOURCES = \
-	util/parse-options.c \
-	util/parse-options.h \
-	util/parse-configs.c \
-	util/parse-configs.h \
-	util/usage.c \
-	util/size.c \
-	util/main.c \
-	util/help.c \
-	util/strbuf.c \
-	util/wrapper.c \
-	util/bitmap.c \
-	util/abspath.c \
-	util/iomem.c \
-	util/util.h \
-	util/strbuf.h \
-	util/size.h \
-	util/main.h \
-	util/filter.h \
-	util/bitmap.h
-
-nobase_include_HEADERS = \
-	daxctl/libdaxctl.h \
-	cxl/libcxl.h \
-	cxl/cxl_mem.h
diff --git a/Makefile.am.in b/Makefile.am.in
deleted file mode 100644
index d6b126986bb4..000000000000
--- a/Makefile.am.in
+++ /dev/null
@@ -1,46 +0,0 @@
-EXTRA_DIST =
-CLEANFILES =
-
-AM_MAKEFLAGS = --no-print-directory
-
-AM_CPPFLAGS = \
-	-include $(top_builddir)/config.h \
-	-DSYSCONFDIR=\""$(sysconfdir)"\" \
-	-DLIBEXECDIR=\""$(libexecdir)"\" \
-	-DPREFIX=\""$(prefix)"\" \
-	-DNDCTL_MAN_PATH=\""$(mandir)"\" \
-	-I${top_srcdir}/ \
-	$(KMOD_CFLAGS) \
-	$(UDEV_CFLAGS) \
-	$(UUID_CFLAGS) \
-	$(JSON_CFLAGS)
-
-AM_CFLAGS = ${my_CFLAGS} \
-	-fvisibility=hidden \
-	-ffunction-sections \
-	-fdata-sections
-
-AM_LDFLAGS = \
-	-Wl,--gc-sections \
-	-Wl,--as-needed
-
-SED_PROCESS = \
-	$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \
-	-e 's,@VERSION\@,$(VERSION),g' \
-	-e 's,@prefix\@,$(prefix),g' \
-	-e 's,@exec_prefix\@,$(exec_prefix),g' \
-	-e 's,@libdir\@,$(libdir),g' \
-	-e 's,@includedir\@,$(includedir),g' \
-	< $< > $@ || rm $@
-
-LIBNDCTL_CURRENT=26
-LIBNDCTL_REVISION=1
-LIBNDCTL_AGE=20
-
-LIBDAXCTL_CURRENT=7
-LIBDAXCTL_REVISION=0
-LIBDAXCTL_AGE=6
-
-LIBCXL_CURRENT=1
-LIBCXL_REVISION=0
-LIBCXL_AGE=0
diff --git a/autogen.sh b/autogen.sh
deleted file mode 100755
index 2a52688bb403..000000000000
--- a/autogen.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh -e
-
-if [ -f .git/hooks/pre-commit.sample -a ! -f .git/hooks/pre-commit ] ; then
-        cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit && \
-        chmod +x .git/hooks/pre-commit && \
-        echo "Activated pre-commit hook."
-fi
-
-$(dirname $0)/git-version-gen
-reconf_args=''
-[ -n "$*" ] && reconf_args="$*"
-autoreconf --install --symlink $reconf_args
-
-libdir() {
-        echo $(cd $1/$(gcc -print-multi-os-directory); pwd)
-}
-
-args="--prefix=/usr \
---sysconfdir=/etc \
---libdir=$(libdir /usr/lib)"
-
-echo
-echo "----------------------------------------------------------------"
-echo "Initialized build system. For a common configuration please run:"
-echo "----------------------------------------------------------------"
-echo
-echo "./configure CFLAGS='-g -O2' $args"
-echo
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index 1b18ed755c98..000000000000
--- a/configure.ac
+++ /dev/null
@@ -1,270 +0,0 @@
-AC_PREREQ(2.60)
-m4_include([version.m4])
-AC_INIT([ndctl],
-        GIT_VERSION,
-        [nvdimm@lists.linux.dev],
-        [ndctl],
-        [https://github.com/pmem/ndctl])
-AC_CONFIG_SRCDIR([ndctl/lib/libndctl.c])
-AC_CONFIG_AUX_DIR([build-aux])
-AM_INIT_AUTOMAKE([
-	foreign
-	1.11
-	-Wall
-	-Wno-portability
-	silent-rules
-	tar-pax
-	no-dist-gzip
-	dist-xz
-	subdir-objects
-])
-AC_PROG_CC_STDC
-AC_USE_SYSTEM_EXTENSIONS
-AC_SYS_LARGEFILE
-AC_CONFIG_MACRO_DIR([m4])
-AM_SILENT_RULES([yes])
-LT_INIT([
-	disable-static
-	pic-only
-])
-AC_PREFIX_DEFAULT([/usr])
-
-AC_PROG_SED
-AC_PROG_MKDIR_P
-AC_PROG_LN_S
-
-AC_ARG_ENABLE([docs],
-        AS_HELP_STRING([--disable-docs],
-	[disable documentation build @<:@default=enabled@:>@]),
-        [], enable_docs=yes)
-AS_IF([test "x$enable_docs" = "xyes"], [
-        AC_DEFINE(ENABLE_DOCS, [1], [Documentation / man pages.])
-])
-AM_CONDITIONAL([ENABLE_DOCS], [test "x$enable_docs" = "xyes"])
-
-AC_ARG_ENABLE([asciidoctor],
-	AS_HELP_STRING([--enable-asciidoctor],
-	[use asciidoctor for documentation build]),
-	[], enable_asciidoctor=yes)
-AM_CONDITIONAL([USE_ASCIIDOCTOR], [test "x$enable_asciidoctor" = "xyes"])
-if test "x$enable_asciidoctor" = "xyes"; then
-	asciidoc="asciidoctor"
-else
-	asciidoc="asciidoc"
-fi
-AC_CHECK_PROG(ASCIIDOC, [$asciidoc], [$(which $asciidoc)], [missing])
-if test "x$ASCIIDOC" = xmissing -a "x$enable_docs" = "xyes"; then
-	AC_MSG_ERROR([$asciidoc needed to build documentation])
-fi
-AC_SUBST([ASCIIDOC])
-
-if test x"$asciidoc" = x"asciidoc"; then
-AC_CHECK_PROG(XMLTO, [xmlto], [$(which xmlto)], [missing])
-if test "x$XMLTO" = xmissing -a "x$enable_docs" = "xyes"; then
-       AC_MSG_ERROR([xmlto needed to build documentation])
-fi
-AC_SUBST([XMLTO])
-fi
-
-AC_C_TYPEOF
-AC_DEFINE([HAVE_STATEMENT_EXPR], 1, [Define to 1 if you have statement expressions.])
-
-AC_C_BIGENDIAN(
-	AC_DEFINE(HAVE_BIG_ENDIAN, 1, [Define to 1 if big-endian-arch]),
-	AC_DEFINE(HAVE_LITTLE_ENDIAN, 1, [Define to 1 if little-endian-arch]),
-	[], [])
-
-AC_ARG_ENABLE([logging],
-        AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
-        [], enable_logging=yes)
-AS_IF([test "x$enable_logging" = "xyes"], [
-        AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
-])
-
-AC_ARG_ENABLE([debug],
-        AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
-        [], [enable_debug=no])
-AS_IF([test "x$enable_debug" = "xyes"], [
-        AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
-])
-
-AC_ARG_ENABLE([destructive],
-        AS_HELP_STRING([--enable-destructive], [enable destructive functional tests @<:@default=disabled@:>@]),
-        [], [enable_destructive=no])
-AS_IF([test "x$enable_destructive" = "xyes"],
-	[AC_DEFINE([ENABLE_DESTRUCTIVE], [1], [destructive functional tests support])])
-AM_CONDITIONAL([ENABLE_DESTRUCTIVE], [test "x$enable_destructive" = "xyes"])
-
-AC_ARG_ENABLE([test],
-        AS_HELP_STRING([--enable-test], [enable ndctl test command @<:@default=disabled@:>@]),
-        [], [enable_test=$enable_destructive])
-AS_IF([test "x$enable_test" = "xyes"],
-	[AC_DEFINE([ENABLE_TEST], [1], [ndctl test support])])
-AM_CONDITIONAL([ENABLE_TEST], [test "x$enable_test" = "xyes"])
-
-AC_CHECK_DECLS([BUS_MCEERR_AR], [enable_bus_mc_err=yes], [], [[#include <signal.h>]])
-AC_CHECK_DECLS([MAP_SHARED_VALIDATE], [kernel_map_shared_validate=yes], [], [[#include <linux/mman.h>]])
-AC_CHECK_DECLS([MAP_SYNC], [kernel_map_sync=yes], [], [[#include <linux/mman.h>]])
-AS_UNSET([ac_cv_have_decl_MAP_SHARED_VALIDATE])
-AS_UNSET([ac_cv_have_decl_MAP_SYNC])
-AC_CHECK_DECLS([MAP_SHARED_VALIDATE], [enable_map_shared_validate=yes], [], [[#include <sys/mman.h>]])
-AC_CHECK_DECLS([MAP_SYNC], [enable_map_sync=yes], [], [[#include <sys/mman.h>]])
-
-if test "x$kernel_map_shared_validate" = "xyes" -a "x$enable_map_shared_validate" != "xyes" ; then
-	AC_MSG_WARN([MAP_SHARED_VALIDATE supported by kernel but not by <sys/mman.h>, consider installing glibc-2.28 or later.])
-fi
-if test "x$kernel_map_shared_validate" != "xyes" -a "x$enable_map_shared_validate" != "xyes" ; then
-	AC_MSG_WARN([MAP_SHARED_VALIDATE not supported by kernel, consider installing kernel-4.15 or later.])
-fi
-if test "x$kernel_map_sync" = "xyes" -a "x$enable_map_sync" != "xyes" ; then
-	AC_MSG_WARN([MAP_SYNC supported by kernel but not by <sys/mman.h>, consider installing glibc-2.28 or later.])
-fi
-if test "x$kernel_map_sync" != "xyes" -a "x$enable_map_sync" != "xyes" ; then
-	AC_MSG_WARN([MAP_SYNC not supported by kernel or architecture, consider installing kernel-4.15 or later.])
-fi
-
-AS_IF([test "x$enable_bus_mc_err" = "xyes" -a "x$enable_map_sync" = "xyes" -a "x$enable_map_shared_validate" = "xyes"],
-	[AC_DEFINE([ENABLE_POISON], [1], [ndctl test poison support])])
-AM_CONDITIONAL([ENABLE_POISON],
-	[test "x$enable_bus_mc_err" = "xyes" -a "x$enable_map_sync" = "xyes" -a "x$enable_map_shared_validate" = "xyes"])
-
-PKG_CHECK_MODULES([KMOD], [libkmod])
-PKG_CHECK_MODULES([UDEV], [libudev])
-PKG_CHECK_MODULES([UUID], [uuid],
-	[AC_DEFINE([HAVE_UUID], [1], [Define to 1 if using libuuid])])
-PKG_CHECK_MODULES([JSON], [json-c])
-
-AC_ARG_WITH([bash],
-	AS_HELP_STRING([--with-bash],
-		[Enable bash auto-completion. @<:@default=yes@:>@]),
-	[],
-	[with_bash=yes])
-
-if test "x$with_bash" = "xyes"; then
-	PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0],
-		[BASH_COMPLETION_DIR=$($PKG_CONFIG --variable=completionsdir bash-completion)], [])
-fi
-
-AC_SUBST([BASH_COMPLETION_DIR])
-AM_CONDITIONAL([ENABLE_BASH_COMPLETION], [test "x$with_bash" = "xyes"])
-
-AC_ARG_ENABLE([local],
-        AS_HELP_STRING([--disable-local], [build against kernel ndctl.h @<:@default=system@:>@]),
-        [], [enable_local=yes])
-
-AC_CHECK_HEADERS_ONCE([linux/version.h])
-
-AC_CHECK_FUNCS([ \
-	__secure_getenv \
-	secure_getenv\
-])
-
-AC_ARG_WITH([systemd],
-	AS_HELP_STRING([--with-systemd],
-		[Enable systemd functionality. @<:@default=yes@:>@]),
-	[], [with_systemd=yes])
-
-if test "x$with_systemd" = "xyes"; then
-	PKG_CHECK_MODULES([SYSTEMD], [systemd],
-	[systemd_unitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)], [])
-fi
-
-AC_SUBST([systemd_unitdir])
-AM_CONDITIONAL([ENABLE_SYSTEMD_UNITS], [test "x$with_systemd" = "xyes"])
-
-ndctl_confdir=${sysconfdir}/ndctl.conf.d
-ndctl_conf=ndctl.conf
-ndctl_monitorconf=monitor.conf
-AC_SUBST([ndctl_confdir])
-AC_SUBST([ndctl_conf])
-AC_SUBST([ndctl_monitorconf])
-
-daxctl_confdir=${sysconfdir}/daxctl.conf.d
-AC_SUBST([daxctl_confdir])
-
-daxctl_modprobe_datadir=${datadir}/daxctl
-daxctl_modprobe_data=daxctl.conf
-AC_SUBST([daxctl_modprobe_datadir])
-AC_SUBST([daxctl_modprobe_data])
-
-AC_ARG_WITH(udevrulesdir,
-    [AS_HELP_STRING([--with-udevrulesdir=DIR], [udev rules.d directory])],
-    [UDEVRULESDIR="$withval"],
-    [UDEVRULESDIR='${prefix}/lib/udev/rules.d']
-)
-AC_SUBST(UDEVRULESDIR)
-
-AC_ARG_WITH([keyutils],
-	    AS_HELP_STRING([--with-keyutils],
-			[Enable keyutils functionality (security).  @<:@default=yes@:>@]), [], [with_keyutils=yes])
-
-if test "x$with_keyutils" = "xyes"; then
-	AC_CHECK_HEADERS([keyutils.h],,[
-		AC_MSG_ERROR([keyutils.h not found, consider installing the keyutils library development package (variously named keyutils-libs-devel, keyutils-devel, or libkeyutils-dev).])
-		])
-fi
-AS_IF([test "x$with_keyutils" = "xyes"],
-	[AC_DEFINE([ENABLE_KEYUTILS], [1], [Enable keyutils support])])
-AM_CONDITIONAL([ENABLE_KEYUTILS], [test "x$with_keyutils" = "xyes"])
-
-ndctl_keysdir=${sysconfdir}/ndctl/keys
-ndctl_keysreadme=keys.readme
-AC_SUBST([ndctl_keysdir])
-AC_SUBST([ndctl_keysreadme])
-
-AC_CHECK_HEADERS([iniparser.h],,[
-		  AC_MSG_ERROR([iniparser.h not found, install iniparser-devel, libiniparser-dev, or so])
-		 ])
-
-my_CFLAGS="\
--Wall \
--Wchar-subscripts \
--Wformat-security \
--Wmissing-declarations \
--Wmissing-prototypes \
--Wnested-externs \
--Wshadow \
--Wsign-compare \
--Wstrict-prototypes \
--Wtype-limits \
--Wmaybe-uninitialized \
--Wdeclaration-after-statement \
--Wunused-result \
--D_FORTIFY_SOURCE=2 \
--O2
-"
-AC_SUBST([my_CFLAGS])
-
-AC_CONFIG_HEADERS(config.h)
-AC_CONFIG_FILES([
-        Makefile
-        daxctl/lib/Makefile
-        cxl/lib/Makefile
-        ndctl/lib/Makefile
-        ndctl/Makefile
-        daxctl/Makefile
-        cxl/Makefile
-        test/Makefile
-        Documentation/ndctl/Makefile
-        Documentation/daxctl/Makefile
-        Documentation/cxl/Makefile
-        Documentation/cxl/lib/Makefile
-])
-
-AC_OUTPUT
-AC_MSG_RESULT([
-        $PACKAGE $VERSION
-        =====
-
-        prefix:                 ${prefix}
-        sysconfdir:             ${sysconfdir}
-        libdir:                 ${libdir}
-        includedir:             ${includedir}
-
-        compiler:               ${CC}
-        cflags:                 ${CFLAGS}
-        ldflags:                ${LDFLAGS}
-
-        logging:                ${enable_logging}
-        debug:                  ${enable_debug}
-])
diff --git a/cxl/Makefile.am b/cxl/Makefile.am
deleted file mode 100644
index ee8488900a3b..000000000000
--- a/cxl/Makefile.am
+++ /dev/null
@@ -1,25 +0,0 @@
-include $(top_srcdir)/Makefile.am.in
-
-bin_PROGRAMS = cxl
-
-DISTCLEANFILES = config.h
-BUILT_SOURCES = config.h
-config.h: $(srcdir)/Makefile.am
-	$(AM_V_GEN) echo "/* Autogenerated by cxl/Makefile.am */" >$@
-
-cxl_SOURCES =\
-		cxl.c \
-		list.c \
-		memdev.c \
-		../util/json.c \
-		json.c \
-		filter.c \
-		filter.h \
-		builtin.h
-
-cxl_LDADD =\
-	lib/libcxl.la \
-	../libutil.a \
-	$(UUID_LIBS) \
-	$(KMOD_LIBS) \
-	$(JSON_LIBS)
diff --git a/cxl/lib/Makefile.am b/cxl/lib/Makefile.am
deleted file mode 100644
index 72c9ccdc3c49..000000000000
--- a/cxl/lib/Makefile.am
+++ /dev/null
@@ -1,32 +0,0 @@
-include $(top_srcdir)/Makefile.am.in
-
-%.pc: %.pc.in Makefile
-	$(SED_PROCESS)
-
-pkginclude_HEADERS = ../libcxl.h ../cxl_mem.h
-lib_LTLIBRARIES = libcxl.la
-
-libcxl_la_SOURCES =\
-	../libcxl.h \
-	private.h \
-	../../util/sysfs.c \
-	../../util/sysfs.h \
-	../../util/log.c \
-	../../util/log.h \
-	libcxl.c
-
-libcxl_la_LIBADD =\
-	$(UUID_LIBS) \
-	$(KMOD_LIBS)
-
-EXTRA_DIST += libcxl.sym
-
-libcxl_la_LDFLAGS = $(AM_LDFLAGS) \
-	-version-info $(LIBCXL_CURRENT):$(LIBCXL_REVISION):$(LIBCXL_AGE) \
-	-Wl,--version-script=$(top_srcdir)/cxl/lib/libcxl.sym
-libcxl_la_DEPENDENCIES = libcxl.sym
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libcxl.pc
-EXTRA_DIST += libcxl.pc.in
-CLEANFILES += libcxl.pc
diff --git a/daxctl/Makefile.am b/daxctl/Makefile.am
deleted file mode 100644
index bbf764f8081f..000000000000
--- a/daxctl/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-include $(top_srcdir)/Makefile.am.in
-
-bin_PROGRAMS = daxctl
-
-DISTCLEANFILES = config.h
-BUILT_SOURCES = config.h
-config.h: $(srcdir)/Makefile.am
-	$(AM_V_GEN) echo "/* Autogenerated by daxctl/Makefile.am */" >$@ && \
-	echo '#define DAXCTL_MODPROBE_DATA \
-		"$(daxctl_modprobe_datadir)/$(daxctl_modprobe_data)"' >>$@ && \
-	echo '#define DAXCTL_MODPROBE_INSTALL \
-		"$(sysconfdir)/modprobe.d/$(daxctl_modprobe_data)"' >>$@
-
-daxctl_SOURCES =\
-		daxctl.c \
-		acpi.c \
-		list.c \
-		migrate.c \
-		device.c \
-		../util/json.c \
-		../util/json.h \
-		json.c \
-		json.h \
-		filter.c \
-		filter.h \
-		builtin.h
-
-daxctl_LDADD =\
-	lib/libdaxctl.la \
-	../ndctl/lib/libndctl.la \
-	../libutil.a \
-	$(UUID_LIBS) \
-	$(KMOD_LIBS) \
-	$(JSON_LIBS) \
-	-liniparser
-
-udevrulesdir = $(UDEVRULESDIR)
-udevrules_DATA = 90-daxctl-device.rules
-
-daxctl_configdir = $(daxctl_confdir)
-daxctl_config_DATA = daxctl.example.conf
-
-if ENABLE_SYSTEMD_UNITS
-systemd_unit_DATA = daxdev-reconfigure@.service
-endif
diff --git a/daxctl/lib/Makefile.am b/daxctl/lib/Makefile.am
deleted file mode 100644
index 3c47a4bbe580..000000000000
--- a/daxctl/lib/Makefile.am
+++ /dev/null
@@ -1,42 +0,0 @@
-include $(top_srcdir)/Makefile.am.in
-
-%.pc: %.pc.in Makefile
-	$(SED_PROCESS)
-
-DISTCLEANFILES = config.h
-BUILT_SOURCES = config.h
-config.h: $(srcdir)/Makefile.am
-	$(AM_V_GEN) echo "/* Autogenerated by daxctl/Makefile.am */" >$@ && \
-		echo '#define DAXCTL_CONF_DIR  "$(daxctl_confdir)"' >>$@
-
-pkginclude_HEADERS = ../libdaxctl.h
-lib_LTLIBRARIES = libdaxctl.la
-
-libdaxctl_la_SOURCES =\
-	../libdaxctl.h \
-	libdaxctl-private.h \
-	../../util/iomem.c \
-	../../util/iomem.h \
-	../../util/sysfs.c \
-	../../util/sysfs.h \
-	../../util/log.c \
-	../../util/log.h \
-	libdaxctl.c
-
-libdaxctl_la_LIBADD =\
-	$(UUID_LIBS) \
-	$(KMOD_LIBS)
-
-daxctl_modprobe_data_DATA = daxctl.conf
-
-EXTRA_DIST += libdaxctl.sym daxctl.conf
-
-libdaxctl_la_LDFLAGS = $(AM_LDFLAGS) \
-	-version-info $(LIBDAXCTL_CURRENT):$(LIBDAXCTL_REVISION):$(LIBDAXCTL_AGE) \
-	-Wl,--version-script=$(top_srcdir)/daxctl/lib/libdaxctl.sym
-libdaxctl_la_DEPENDENCIES = libdaxctl.sym
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libdaxctl.pc
-EXTRA_DIST += libdaxctl.pc.in
-CLEANFILES += libdaxctl.pc
diff --git a/ndctl.spec.in b/ndctl.spec.in
index 9447267839d2..7e838f4bf199 100644
--- a/ndctl.spec.in
+++ b/ndctl.spec.in
@@ -6,21 +6,16 @@ License:	GPLv2
 Url:		https://github.com/pmem/ndctl
 Source0:	https://github.com/pmem/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
 
-%define with_meson MESON
 Requires:	LNAME%{?_isa} = %{version}-%{release}
 Requires:	DAX_LNAME%{?_isa} = %{version}-%{release}
 Requires:	CXL_LNAME%{?_isa} = %{version}-%{release}
 BuildRequires:	autoconf
 %if 0%{?rhel} < 9
 BuildRequires:	asciidoc
-%if !%{with_meson}
-%define asciidoc --disable-asciidoctor
-%endif
+%define asciidoctor -Dasciidoctor=disabled
 %else
-%if %{with_meson}
-%define asciidoctor -Dasciidoctor=enabled
-%endif
 BuildRequires:	rubygem-asciidoctor
+%define asciidoctor -Dasciidoctor=enabled
 %endif
 BuildRequires:	xmlto
 BuildRequires:	automake
@@ -35,10 +30,7 @@ BuildRequires:	pkgconfig(systemd)
 BuildRequires:	keyutils-libs-devel
 BuildRequires:	systemd-rpm-macros
 BuildRequires:	iniparser-devel
-
-%if %{with_meson}
 BuildRequires:	meson
-%endif
 
 %description
 Utility library for managing the "libnvdimm" subsystem.  The "libnvdimm"
@@ -127,30 +119,14 @@ libcxl is a library for enumerating and communicating with CXL devices.
 %setup -q ndctl-%{version}
 
 %build
-%if %{with_meson}
 %meson %{?asciidoctor} -Dversion-tag=%{version}
 %meson_build
-%else
-echo %{version} > version
-./autogen.sh
-%configure --disable-static --disable-silent-rules %{?asciidoc}
-make %{?_smp_mflags}
-%endif
 
 %install
-%if %{with_meson}
 %meson_install
-%else
-%make_install
-find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
-%endif
 
 %check
-%if %{with_meson}
 %meson_test
-%else
-make check
-%endif
 
 %ldconfig_scriptlets -n LNAME
 
diff --git a/ndctl/Makefile.am b/ndctl/Makefile.am
deleted file mode 100644
index 5d5b1cacda9d..000000000000
--- a/ndctl/Makefile.am
+++ /dev/null
@@ -1,86 +0,0 @@
-include $(top_srcdir)/Makefile.am.in
-
-bin_PROGRAMS = ndctl
-
-DISTCLEANFILES = config.h
-BUILT_SOURCES = config.h
-config.h: $(srcdir)/Makefile.am
-	$(AM_V_GEN) echo "/* Autogenerated by ndctl/Makefile.am */" >$@ && \
-	echo '#define NDCTL_CONF_FILE \
-		"$(ndctl_confdir)/$(ndctl_monitorconf)"' >>$@
-	$(AM_V_GEN) echo '#define NDCTL_KEYS_DIR  "$(ndctl_keysdir)"' >>$@
-
-ndctl_SOURCES = ndctl.c \
-		builtin.h \
-		bus.c \
-		create-nfit.c \
-		namespace.c \
-		check.c \
-		region.c \
-		dimm.c \
-		../util/log.c \
-		../daxctl/filter.c \
-		../daxctl/filter.h \
-		filter.c \
-		filter.h \
-		list.c \
-		../util/json.c \
-		../util/json.h \
-		../daxctl/json.c \
-		../daxctl/json.h \
-		json.c \
-		json.h \
-		json-smart.c \
-		keys.h \
-		inject-error.c \
-		inject-smart.c \
-		monitor.c \
-		namespace.h \
-		action.h \
-		../nfit.h \
-		../test.h \
-		firmware-update.h
-
-if ENABLE_KEYUTILS
-ndctl_SOURCES += keys.c \
-		load-keys.c
-keys_configdir = $(ndctl_keysdir)
-keys_config_DATA = $(ndctl_keysreadme)
-endif
-
-EXTRA_DIST += keys.readme monitor.conf ndctl-monitor.service ndctl.conf
-
-if ENABLE_DESTRUCTIVE
-ndctl_SOURCES += ../test/pmem_namespaces.c
-ndctl_SOURCES += bat.c
-endif
-
-ndctl_LDADD =\
-	lib/libndctl.la \
-	../daxctl/lib/libdaxctl.la \
-	../libutil.a \
-	$(UUID_LIBS) \
-	$(KMOD_LIBS) \
-	$(JSON_LIBS) \
-	-liniparser
-
-if ENABLE_KEYUTILS
-ndctl_LDADD += -lkeyutils
-endif
-
-if ENABLE_TEST
-ndctl_SOURCES += ../test/libndctl.c \
-		 ../test/dsm-fail.c \
-		 ../util/sysfs.c \
-		 ../test/core.c \
-		 test.c
-endif
-
-ndctl_configdir = $(ndctl_confdir)
-ndctl_config_DATA = $(ndctl_conf)
-monitor_configdir = $(ndctl_confdir)
-monitor_config_DATA = $(ndctl_monitorconf)
-
-if ENABLE_SYSTEMD_UNITS
-systemd_unit_DATA = ndctl-monitor.service
-endif
diff --git a/ndctl/lib/Makefile.am b/ndctl/lib/Makefile.am
deleted file mode 100644
index 0a52c01da347..000000000000
--- a/ndctl/lib/Makefile.am
+++ /dev/null
@@ -1,58 +0,0 @@
-include $(top_srcdir)/Makefile.am.in
-
-%.pc: %.pc.in Makefile
-	$(SED_PROCESS)
-
-DISTCLEANFILES = config.h
-BUILT_SOURCES = config.h
-config.h: $(srcdir)/Makefile.am
-	$(AM_V_GEN) echo "/* Autogenerated by ndctl/Makefile.am */" >$@ && \
-		echo '#define NDCTL_CONF_DIR  "$(ndctl_confdir)"' >>$@
-
-pkginclude_HEADERS = ../libndctl.h ../ndctl.h
-lib_LTLIBRARIES = libndctl.la
-
-libndctl_la_SOURCES =\
-	../libndctl.h \
-	private.h \
-	../../util/list.h \
-	../../util/log.c \
-	../../util/log.h \
-	../../util/sysfs.c \
-	../../util/sysfs.h \
-	../../util/fletcher.h \
-	dimm.c \
-	inject.c \
-	nfit.c \
-	smart.c \
-	intel.c \
-	hpe1.c \
-	msft.c \
-	hyperv.c \
-	papr.c \
-	ars.c \
-	firmware.c \
-	libndctl.c \
-	intel.h \
-	hpe1.h \
-	msft.h \
-	hyperv.h \
-	../../ndctl/libndctl-nfit.h
-
-libndctl_la_LIBADD =\
-	../../daxctl/lib/libdaxctl.la \
-	$(UDEV_LIBS) \
-	$(UUID_LIBS) \
-	$(KMOD_LIBS)
-
-EXTRA_DIST += libndctl.sym
-
-libndctl_la_LDFLAGS = $(AM_LDFLAGS) \
-	-version-info $(LIBNDCTL_CURRENT):$(LIBNDCTL_REVISION):$(LIBNDCTL_AGE) \
-	-Wl,--version-script=$(top_srcdir)/ndctl/lib/libndctl.sym
-libndctl_la_DEPENDENCIES = libndctl.sym
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libndctl.pc
-EXTRA_DIST += libndctl.pc.in
-CLEANFILES += libndctl.pc
diff --git a/rhel/meson.build b/rhel/meson.build
index 8672098d84e1..85b47bcd485a 100644
--- a/rhel/meson.build
+++ b/rhel/meson.build
@@ -7,8 +7,7 @@ rhel_spec1 = vcs_tag(
 
 rhel_spec2 = custom_target('ndctl.spec',
   command : [
-    'sed', '-e', 's,MESON,1,g',
-	   '-e', 's,DAX_DNAME,daxctl-devel,g',
+    'sed', '-e', 's,DAX_DNAME,daxctl-devel,g',
 	   '-e', 's,CXL_DNAME,cxl-devel,g',
 	   '-e', 's,DNAME,ndctl-devel,g',
 	   '-e', '/^%defattr.*/d',
diff --git a/sles/meson.build b/sles/meson.build
index 21c72cb4f5ec..8512774b6d20 100644
--- a/sles/meson.build
+++ b/sles/meson.build
@@ -18,8 +18,7 @@ sles_spec2 = custom_target('ndctl.spec.in',
 
 sles_spec3 = custom_target('ndctl.spec',
   command : [
-    'sed', '-e', 's,MESON,1,g',
-           '-e', 's,DAX_DNAME,libdaxctl-devel,g',
+    'sed', '-e', 's,DAX_DNAME,libdaxctl-devel,g',
            '-e', 's,CXL_DNAME,libcxl-devel,g',
            '-e', 's,DNAME,libndctl-devel,g',
            '-e', 's,%license,%doc,g',
diff --git a/test/Makefile.am b/test/Makefile.am
deleted file mode 100644
index a2a4ee4a4335..000000000000
--- a/test/Makefile.am
+++ /dev/null
@@ -1,169 +0,0 @@
-include $(top_srcdir)/Makefile.am.in
-
-TESTS =\
-	libndctl \
-	dsm-fail \
-	create.sh \
-	clear.sh \
-	pmem-errors.sh \
-	daxdev-errors.sh \
-	multi-dax.sh \
-	btt-check.sh \
-	label-compat.sh \
-	sector-mode.sh \
-	inject-error.sh \
-	btt-errors.sh \
-	hugetlb \
-	btt-pad-compat.sh \
-	firmware-update.sh \
-	ack-shutdown-count-set \
-	rescan-partitions.sh \
-	inject-smart.sh \
-	monitor.sh \
-	max_available_extent_ns.sh \
-	pfn-meta-errors.sh \
-	track-uuid.sh
-
-EXTRA_DIST += $(TESTS) common \
-		btt-pad-compat.xxd \
-		nmem1.bin nmem2.bin nmem3.bin nmem4.bin
-
-check_PROGRAMS =\
-	libndctl \
-	dsm-fail \
-	dax-errors \
-	smart-notify \
-	smart-listen \
-	hugetlb \
-	daxdev-errors \
-	ack-shutdown-count-set \
-	list-smart-dimm
-
-if ENABLE_DESTRUCTIVE
-TESTS +=\
-	pmem-ns \
-	sub-section.sh \
-	dax-dev \
-	dax-ext4.sh \
-	dax-xfs.sh \
-	align.sh \
-	device-dax \
-	revoke-devmem \
-	device-dax-fio.sh \
-	daxctl-devices.sh \
-	daxctl-create.sh \
-	dm.sh \
-	mmap.sh
-
-if ENABLE_KEYUTILS
-TESTS += security.sh
-endif
-
-check_PROGRAMS +=\
-	pmem-ns \
-	dax-dev \
-	dax-pmd \
-	device-dax \
-	revoke-devmem \
-	mmap
-endif
-
-LIBNDCTL_LIB =\
-       ../ndctl/lib/libndctl.la \
-       ../daxctl/lib/libdaxctl.la
-
-testcore =\
-	core.c \
-	../util/log.c \
-	../util/sysfs.c
-
-libndctl_SOURCES = libndctl.c $(testcore)
-libndctl_LDADD = $(LIBNDCTL_LIB) $(UUID_LIBS) $(KMOD_LIBS)
-
-namespace_core =\
-	../ndctl/namespace.c \
-	../ndctl/filter.c \
-	../ndctl/check.c \
-	../util/json.c \
-	../ndctl/json.c \
-	../daxctl/filter.c \
-	../daxctl/json.c
-
-dsm_fail_SOURCES =\
-	dsm-fail.c \
-	$(testcore) \
-	$(namespace_core)
-
-dsm_fail_LDADD = $(LIBNDCTL_LIB) \
-		$(KMOD_LIBS) \
-		$(JSON_LIBS) \
-		$(UUID_LIBS) \
-		../libutil.a
-
-ack_shutdown_count_set_SOURCES =\
-	ack-shutdown-count-set.c \
-	$(testcore)
-
-ack_shutdown_count_set_LDADD = $(LIBNDCTL_LIB) $(KMOD_LIBS)
-
-pmem_ns_SOURCES = pmem_namespaces.c $(testcore)
-pmem_ns_LDADD = $(LIBNDCTL_LIB) $(KMOD_LIBS) $(UUID_LIBS)
-
-dax_dev_SOURCES = dax-dev.c $(testcore)
-dax_dev_LDADD = $(LIBNDCTL_LIB) $(KMOD_LIBS)
-
-dax_pmd_SOURCES = dax-pmd.c \
-		$(testcore)
-
-hugetlb_SOURCES = hugetlb.c \
-		  dax-pmd.c
-
-mmap_SOURCES = mmap.c
-dax_errors_SOURCES = dax-errors.c
-daxdev_errors_SOURCES = daxdev-errors.c \
-			../util/log.c \
-			../util/sysfs.c
-daxdev_errors_LDADD = $(LIBNDCTL_LIB)
-device_dax_SOURCES = \
-		device-dax.c \
-		dax-dev.c \
-		dax-pmd.c \
-		$(testcore) \
-		$(namespace_core)
-
-if ENABLE_POISON
-dax_pmd_SOURCES += dax-poison.c
-hugetlb_SOURCES += dax-poison.c
-device_dax_SOURCES += dax-poison.c
-endif
-
-device_dax_LDADD = \
-		$(LIBNDCTL_LIB) \
-		$(KMOD_LIBS) \
-		$(JSON_LIBS) \
-                $(UUID_LIBS) \
-		../libutil.a
-
-revoke_devmem_SOURCES = \
-		revoke-devmem.c \
-		dax-dev.c \
-		$(testcore)
-
-revoke_devmem_LDADD = $(LIBNDCTL_LIB)
-
-smart_notify_SOURCES = smart-notify.c
-smart_notify_LDADD = $(LIBNDCTL_LIB)
-smart_listen_SOURCES = smart-listen.c
-smart_listen_LDADD = $(LIBNDCTL_LIB)
-
-list_smart_dimm_SOURCES = \
-		list-smart-dimm.c \
-		../ndctl/filter.c \
-		../util/json.c \
-		../ndctl/json.c
-
-list_smart_dimm_LDADD = \
-		$(LIBNDCTL_LIB) \
-		$(JSON_LIBS) \
-		$(UUID_LIBS) \
-		../libutil.a


^ permalink raw reply related

* [ndctl PATCH v3 12/16] test: Prepare out of line builds
From: Dan Williams @ 2022-01-05 21:32 UTC (permalink / raw)
  To: vishal.l.verma; +Cc: nvdimm, linux-cxl
In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com>

In preparation for converting to meson prepare the unit tests to run out of
a build directory rather than out of the source directory. Introduce
TEST_PATH for the location of the test executables.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/btt-errors.sh     |    4 +---
 test/common            |   37 +++++++++++++++++++++----------------
 test/dax-pmd.c         |   11 +++++++++--
 test/dax.sh            |    6 +++---
 test/daxdev-errors.sh  |    4 ++--
 test/device-dax-fio.sh |    2 +-
 test/dm.sh             |    4 ++--
 test/inject-smart.sh   |    2 +-
 test/mmap.sh           |    6 +++---
 test/monitor.sh        |    6 +++---
 test/pmem-errors.sh    |    8 +++-----
 test/sub-section.sh    |    4 ++--
 test/track-uuid.sh     |    2 +-
 13 files changed, 52 insertions(+), 44 deletions(-)

diff --git a/test/btt-errors.sh b/test/btt-errors.sh
index 6e69178cc3cf..18518d503e9c 100755
--- a/test/btt-errors.sh
+++ b/test/btt-errors.sh
@@ -11,14 +11,12 @@ rc=77
 
 cleanup()
 {
-	rm -f $FILE
-	rm -f $MNT/$FILE
 	if grep -q "$MNT" /proc/mounts; then
 		umount $MNT
 	else
 		rc=77
 	fi
-	rmdir $MNT
+	rm -rf $MNT
 }
 
 force_raw()
diff --git a/test/common b/test/common
index b6d47128f209..fb487958a29b 100644
--- a/test/common
+++ b/test/common
@@ -4,27 +4,32 @@
 # Global variables
 
 # NDCTL
-#
-if [ -f "../ndctl/ndctl" ] && [ -x "../ndctl/ndctl" ]; then
-	export NDCTL=../ndctl/ndctl
-elif [ -f "./ndctl/ndctl" ] && [ -x "./ndctl/ndctl" ]; then
-	export NDCTL=./ndctl/ndctl
-else
-	echo "Couldn't find an ndctl binary"
-	exit 1
+if [ -z $NDCTL ]; then
+	if [ -f "../ndctl/ndctl" ] && [ -x "../ndctl/ndctl" ]; then
+		export NDCTL=../ndctl/ndctl
+	elif [ -f "./ndctl/ndctl" ] && [ -x "./ndctl/ndctl" ]; then
+		export NDCTL=./ndctl/ndctl
+	else
+		echo "Couldn't find an ndctl binary"
+		exit 1
+	fi
 fi
 
 # DAXCTL
-#
-if [ -f "../daxctl/daxctl" ] && [ -x "../daxctl/daxctl" ]; then
-	export DAXCTL=../daxctl/daxctl
-elif [ -f "./daxctl/daxctl" ] && [ -x "./daxctl/daxctl" ]; then
-	export DAXCTL=./daxctl/daxctl
-else
-	echo "Couldn't find an daxctl binary"
-	exit 1
+if [ -z $DAXCTL ]; then
+	if [ -f "../daxctl/daxctl" ] && [ -x "../daxctl/daxctl" ]; then
+		export DAXCTL=../daxctl/daxctl
+	elif [ -f "./daxctl/daxctl" ] && [ -x "./daxctl/daxctl" ]; then
+		export DAXCTL=./daxctl/daxctl
+	else
+		echo "Couldn't find an daxctl binary"
+		exit 1
+	fi
 fi
 
+if [ -z $TEST_PATH ]; then
+	export TEST_PATH=.
+fi
 
 # NFIT_TEST_BUS[01]
 #
diff --git a/test/dax-pmd.c b/test/dax-pmd.c
index 7648e348b0a6..f8408759d51e 100644
--- a/test/dax-pmd.c
+++ b/test/dax-pmd.c
@@ -24,7 +24,8 @@
 	__func__, __LINE__, strerror(errno))
 #define faili(i) fprintf(stderr, "%s: failed at: %d: %d (%s)\n", \
 	__func__, __LINE__, i, strerror(errno))
-#define TEST_FILE "test_dax_data"
+#define TEST_DIR "test_dax_mnt"
+#define TEST_FILE TEST_DIR "/test_dax_data"
 
 #define REGION_MEM_SIZE 4096*4
 #define REGION_PM_SIZE        4096*512
@@ -171,8 +172,14 @@ int test_dax_directio(int dax_fd, unsigned long align, void *dax_addr, off_t off
 		}
 		rc = -ENXIO;
 
+		rc = mkdir(TEST_DIR, 0600);
+		if (rc < 0 && errno != EEXIST) {
+			faili(i);
+			munmap(addr, 2 * align);
+			break;
+		}
 		fd2 = open(TEST_FILE, O_CREAT|O_TRUNC|O_DIRECT|O_RDWR,
-				DEFFILEMODE);
+				0600);
 		if (fd2 < 0) {
 			faili(i);
 			munmap(addr, 2*align);
diff --git a/test/dax.sh b/test/dax.sh
index bcdd4e9bda27..bb9848b10ecc 100755
--- a/test/dax.sh
+++ b/test/dax.sh
@@ -15,13 +15,13 @@ cleanup() {
 	else
 		rc=77
 	fi
-	rmdir $MNT
+	rm -rf $MNT
 	exit $rc
 }
 
 run_test() {
 	rc=0
-	if ! trace-cmd record -e fs_dax:dax_pmd_fault_done ./dax-pmd $MNT/$FILE; then
+	if ! trace-cmd record -e fs_dax:dax_pmd_fault_done $TEST_PATH/dax-pmd $MNT/$FILE; then
 		rc=$?
 		if [ "$rc" -ne 77 ] && [ "$rc" -ne 0 ]; then
 			cleanup "$1"
@@ -104,7 +104,7 @@ set -e
 mkdir -p $MNT
 trap 'err $LINENO cleanup' ERR
 
-dev=$(./dax-dev)
+dev=$($TEST_PATH/dax-dev)
 json=$($NDCTL list -N -n $dev)
 eval $(json2var <<< "$json")
 rc=1
diff --git a/test/daxdev-errors.sh b/test/daxdev-errors.sh
index e13453dfaa73..7f79718113d0 100755
--- a/test/daxdev-errors.sh
+++ b/test/daxdev-errors.sh
@@ -62,8 +62,8 @@ read sector len < /sys/bus/nd/devices/$region/badblocks
 echo "sector: $sector len: $len"
 
 # run the daxdev-errors test
-test -x ./daxdev-errors
-./daxdev-errors $busdev $region
+test -x $TEST_PATH/daxdev-errors
+$TEST_PATH/daxdev-errors $busdev $region
 
 # check badblocks, should be empty
 if read sector len < /sys/bus/platform/devices/nfit_test.0/$busdev/$region/badblocks; then
diff --git a/test/device-dax-fio.sh b/test/device-dax-fio.sh
index f57a9d266afc..c43ac058d2b0 100755
--- a/test/device-dax-fio.sh
+++ b/test/device-dax-fio.sh
@@ -18,7 +18,7 @@ if ! fio --enghelp | grep -q "dev-dax"; then
 	exit 77
 fi
 
-dev=$(./dax-dev)
+dev=$($TEST_PATH/dax-dev)
 for align in 4k 2m 1g
 do
 	json=$($NDCTL create-namespace -m devdax -a $align -f -e $dev)
diff --git a/test/dm.sh b/test/dm.sh
index 4656e5bfbebe..b780a65c27d2 100755
--- a/test/dm.sh
+++ b/test/dm.sh
@@ -8,7 +8,7 @@ SKIP=77
 FAIL=1
 SUCCESS=0
 
-. ./common
+. $(dirname $0)/common
 
 MNT=test_dax_mnt
 TEST_DM_PMEM=/dev/mapper/test_pmem
@@ -30,7 +30,7 @@ cleanup() {
 	if [ -L $TEST_DM_PMEM ]; then
 		dmsetup remove $TEST_DM_PMEM
 	fi
-	rmdir $MNT
+	rm -rf $MNT
 	# opportunistic cleanup, not fatal if these fail
 	namespaces=$($NDCTL list -N | jq -r ".[] | select(.name==\"$NAME\") | .dev")
 	for i in $namespaces
diff --git a/test/inject-smart.sh b/test/inject-smart.sh
index 4ca83b8b2263..8b913601bdd2 100755
--- a/test/inject-smart.sh
+++ b/test/inject-smart.sh
@@ -170,7 +170,7 @@ check_prereq "jq"
 modprobe nfit_test
 rc=1
 
-jlist=$(./list-smart-dimm -b $bus)
+jlist=$($TEST_PATH/list-smart-dimm -b $bus)
 dimm="$(jq '.[]."dev"?, ."dev"?' <<< $jlist | sort | head -1 | xargs)"
 test -n "$dimm"
 
diff --git a/test/mmap.sh b/test/mmap.sh
index 50a1d34d0b75..760257dc7f93 100755
--- a/test/mmap.sh
+++ b/test/mmap.sh
@@ -7,7 +7,7 @@
 MNT=test_mmap_mnt
 FILE=image
 DEV=""
-TEST=./mmap
+TEST=$TEST_PATH/mmap
 rc=77
 
 cleanup() {
@@ -17,7 +17,7 @@ cleanup() {
 	else
 		rc=77
 	fi
-	rmdir $MNT
+	rm -rf $MNT
 	exit $rc
 }
 
@@ -49,7 +49,7 @@ set -e
 mkdir -p $MNT
 trap 'err $LINENO cleanup' ERR
 
-dev=$(./dax-dev)
+dev=$($TEST_PATH/dax-dev)
 json=$($NDCTL list -N -n $dev)
 eval $(json2var <<< "$json")
 DEV="/dev/${blockdev}"
diff --git a/test/monitor.sh b/test/monitor.sh
index 14450a7b23e3..ef04607d8eb0 100755
--- a/test/monitor.sh
+++ b/test/monitor.sh
@@ -31,7 +31,7 @@ start_monitor()
 set_smart_supported_bus()
 {
 	smart_supported_bus=$NFIT_TEST_BUS0
-	monitor_dimms=$(./list-smart-dimm -b $smart_supported_bus | jq -r .[0].dev)
+	monitor_dimms=$($TEST_PATH/list-smart-dimm -b $smart_supported_bus | jq -r .[0].dev)
 	if [ -z $monitor_dimms ]; then
 		smart_supported_bus=$NFIT_TEST_BUS1
 	fi
@@ -39,14 +39,14 @@ set_smart_supported_bus()
 
 get_monitor_dimm()
 {
-	jlist=$(./list-smart-dimm -b $smart_supported_bus $1)
+	jlist=$($TEST_PATH/list-smart-dimm -b $smart_supported_bus $1)
 	monitor_dimms=$(jq '.[]."dev"?, ."dev"?' <<<$jlist | sort | uniq | xargs)
 	echo $monitor_dimms
 }
 
 call_notify()
 {
-	./smart-notify $smart_supported_bus
+	$TEST_PATH/smart-notify $smart_supported_bus
 	sync; sleep 3
 }
 
diff --git a/test/pmem-errors.sh b/test/pmem-errors.sh
index 20657801fc0e..9a59c25d4a79 100755
--- a/test/pmem-errors.sh
+++ b/test/pmem-errors.sh
@@ -10,14 +10,12 @@ rc=77
 
 cleanup()
 {
-	rm -f $FILE
-	rm -f $MNT/$FILE
 	if [ -n "$blockdev" ]; then
 		umount /dev/$blockdev
 	else
 		rc=77
 	fi
-	rmdir $MNT
+	rm -rf $MNT
 }
 
 check_min_kver "4.7" || do_skip "may lack dax error handling"
@@ -82,8 +80,8 @@ echo $start_sect 8 > /sys/block/$blockdev/badblocks
 dd if=$MNT/$FILE of=/dev/null iflag=direct bs=4096 count=1 && err $LINENO || true
 
 # run the dax-errors test
-test -x ./dax-errors
-./dax-errors $MNT/$FILE
+test -x $TEST_PATH/dax-errors
+$TEST_PATH/dax-errors $MNT/$FILE
 
 # TODO: disable this check till we have clear-on-write in the kernel
 #if read sector len < /sys/block/$blockdev/badblocks; then
diff --git a/test/sub-section.sh b/test/sub-section.sh
index 92ae816c448c..77b963355c8f 100755
--- a/test/sub-section.sh
+++ b/test/sub-section.sh
@@ -8,7 +8,7 @@ SKIP=77
 FAIL=1
 SUCCESS=0
 
-. ./common
+. $(dirname $0)/common
 
 check_min_kver "5.3" || do_skip "may lack align sub-section hotplug support"
 
@@ -30,7 +30,7 @@ cleanup() {
 	if mountpoint -q $MNT; then
 		umount $MNT
 	fi
-	rmdir $MNT
+	rm -rf $MNT
 	# opportunistic cleanup, not fatal if these fail
 	namespaces=$($NDCTL list -N | jq -r ".[] | select(.name==\"$NAME\") | .dev")
 	for i in $namespaces
diff --git a/test/track-uuid.sh b/test/track-uuid.sh
index 3bacd2c24787..a967d0e4691c 100755
--- a/test/track-uuid.sh
+++ b/test/track-uuid.sh
@@ -5,7 +5,7 @@
 blockdev=""
 rc=77
 
-. ./common
+. $(dirname $0)/common
 
 set -e
 trap 'err $LINENO' ERR


^ permalink raw reply related

* [ndctl PATCH v3 10/16] Documentation: Drop attrs.adoc include
From: Dan Williams @ 2022-01-05 21:32 UTC (permalink / raw)
  To: vishal.l.verma; +Cc: nvdimm, linux-cxl
In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com>

In preparation for switching build systems, drop the attrs.adoc include for
communicating variables to asciidoc. Simply add the necessary variable
values to the invocation of the command using the --attribute argument.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 .gitignore                                         |    1 -
 Documentation/daxctl/Makefile.am                   |   17 +++++++----------
 Documentation/daxctl/daxctl-reconfigure-device.txt |    2 --
 Documentation/ndctl/Makefile.am                    |   17 +++++++----------
 Documentation/ndctl/intel-nvdimm-security.txt      |    2 --
 Documentation/ndctl/ndctl-load-keys.txt            |    2 --
 Documentation/ndctl/ndctl-monitor.txt              |    2 --
 Documentation/ndctl/ndctl-sanitize-dimm.txt        |    2 --
 Documentation/ndctl/ndctl-setup-passphrase.txt     |    2 --
 Documentation/ndctl/ndctl-update-passphrase.txt    |    2 --
 10 files changed, 14 insertions(+), 35 deletions(-)

diff --git a/.gitignore b/.gitignore
index 6b19d90a12f1..4ab393e71a89 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,7 +23,6 @@ Documentation/daxctl/asciidoctor-extensions.rb
 Documentation/ndctl/asciidoctor-extensions.rb
 Documentation/cxl/asciidoctor-extensions.rb
 Documentation/cxl/lib/asciidoctor-extensions.rb
-Documentation/ndctl/attrs.adoc
 .dirstamp
 daxctl/config.h
 daxctl/daxctl
diff --git a/Documentation/daxctl/Makefile.am b/Documentation/daxctl/Makefile.am
index 9c43e6176b28..78c47f5055c4 100644
--- a/Documentation/daxctl/Makefile.am
+++ b/Documentation/daxctl/Makefile.am
@@ -33,20 +33,11 @@ EXTRA_DIST = $(man1_MANS)
 
 CLEANFILES = $(man1_MANS)
 
-.ONESHELL:
-attrs.adoc: $(srcdir)/Makefile.am
-	$(AM_V_GEN) cat <<- EOF >$@
-		:daxctl_confdir: $(daxctl_confdir)
-		:daxctl_conf: $(daxctl_conf)
-		:ndctl_keysdir: $(ndctl_keysdir)
-		EOF
-
 XML_DEPS = \
 	../../version.m4 \
 	../copyright.txt \
 	Makefile \
-	$(CONFFILE) \
-	attrs.adoc
+	$(CONFFILE)
 
 RM ?= rm -f
 
@@ -57,6 +48,9 @@ if USE_ASCIIDOCTOR
 		$(ASCIIDOC) -b manpage -d manpage -acompat-mode \
 		-I. -rasciidoctor-extensions \
 		-amansource=daxctl -amanmanual="daxctl Manual" \
+		-adaxctl_confdir=$(daxctl_confdir) \
+		-adaxctl_conf=$(daxctl_conf) \
+		-andctl_keysdir=$(ndctl_keysdir) \
 		-andctl_version=$(VERSION) -o $@+ $< && \
 		mv $@+ $@
 
@@ -65,6 +59,9 @@ else
 %.xml: %.txt $(XML_DEPS)
 	$(AM_V_GEN)$(RM) $@+ $@ && \
 		$(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
+		-adaxctl_confdir=$(daxctl_confdir) \
+		-adaxctl_conf=$(daxctl_conf) \
+		-andctl_keysdir=$(ndctl_keysdir) \
 		--unsafe -adaxctl_version=$(VERSION) -o $@+ $< && \
 		mv $@+ $@
 
diff --git a/Documentation/daxctl/daxctl-reconfigure-device.txt b/Documentation/daxctl/daxctl-reconfigure-device.txt
index b2184ec862bb..385c0c53931d 100644
--- a/Documentation/daxctl/daxctl-reconfigure-device.txt
+++ b/Documentation/daxctl/daxctl-reconfigure-device.txt
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-include::attrs.adoc[]
-
 daxctl-reconfigure-device(1)
 ============================
 
diff --git a/Documentation/ndctl/Makefile.am b/Documentation/ndctl/Makefile.am
index 37855cc0585d..203158c1dfaf 100644
--- a/Documentation/ndctl/Makefile.am
+++ b/Documentation/ndctl/Makefile.am
@@ -56,14 +56,6 @@ EXTRA_DIST = $(man1_MANS)
 
 CLEANFILES = $(man1_MANS)
 
-.ONESHELL:
-attrs.adoc: $(srcdir)/Makefile.am
-	$(AM_V_GEN) cat <<- EOF >$@
-		:ndctl_confdir: $(ndctl_confdir)
-		:ndctl_monitorconf: $(ndctl_monitorconf)
-		:ndctl_keysdir: $(ndctl_keysdir)
-		EOF
-
 XML_DEPS = \
 	../../version.m4 \
 	Makefile \
@@ -76,8 +68,7 @@ XML_DEPS = \
 	xable-namespace-options.txt \
 	ars-description.txt \
 	labels-description.txt \
-	labels-options.txt \
-	attrs.adoc
+	labels-options.txt
 
 RM ?= rm -f
 
@@ -88,6 +79,9 @@ if USE_ASCIIDOCTOR
 		$(ASCIIDOC) -b manpage -d manpage -acompat-mode \
 		-I. -rasciidoctor-extensions \
 		-amansource=ndctl -amanmanual="ndctl Manual" \
+		-andctl_confdir=$(ndctl_confdir) \
+		-andctl_monitorconf=$(ndctl_monitorconf) \
+		-andctl_keysdir=$(ndctl_keysdir) \
 		-andctl_version=$(VERSION) -o $@+ $< && \
 		mv $@+ $@
 
@@ -96,6 +90,9 @@ else
 %.xml: %.txt $(XML_DEPS)
 	$(AM_V_GEN)$(RM) $@+ $@ && \
 		$(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
+		-andctl_confdir=$(ndctl_confdir) \
+		-andctl_monitorconf=$(ndctl_monitorconf) \
+		-andctl_keysdir=$(ndctl_keysdir) \
 		--unsafe -andctl_version=$(VERSION) -o $@+ $< && \
 		mv $@+ $@
 
diff --git a/Documentation/ndctl/intel-nvdimm-security.txt b/Documentation/ndctl/intel-nvdimm-security.txt
index 142b4603db69..88b305b81978 100644
--- a/Documentation/ndctl/intel-nvdimm-security.txt
+++ b/Documentation/ndctl/intel-nvdimm-security.txt
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-include::attrs.adoc[]
-
 THEORY OF OPERATION
 -------------------
 The Intel Device Specific Methods (DSM) specification v1.7 and v1.8 [1]
diff --git a/Documentation/ndctl/ndctl-load-keys.txt b/Documentation/ndctl/ndctl-load-keys.txt
index a064f97fd069..70db57441820 100644
--- a/Documentation/ndctl/ndctl-load-keys.txt
+++ b/Documentation/ndctl/ndctl-load-keys.txt
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-include::attrs.adoc[]
-
 ndctl-load-keys(1)
 ==================
 
diff --git a/Documentation/ndctl/ndctl-monitor.txt b/Documentation/ndctl/ndctl-monitor.txt
index 8c8c35b41ace..eca079d56a32 100644
--- a/Documentation/ndctl/ndctl-monitor.txt
+++ b/Documentation/ndctl/ndctl-monitor.txt
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-include::attrs.adoc[]
-
 ndctl-monitor(1)
 ================
 
diff --git a/Documentation/ndctl/ndctl-sanitize-dimm.txt b/Documentation/ndctl/ndctl-sanitize-dimm.txt
index b2e5fde9ecb3..e04467856ca4 100644
--- a/Documentation/ndctl/ndctl-sanitize-dimm.txt
+++ b/Documentation/ndctl/ndctl-sanitize-dimm.txt
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-include::attrs.adoc[]
-
 ndctl-sanitize-dimm(1)
 ======================
 
diff --git a/Documentation/ndctl/ndctl-setup-passphrase.txt b/Documentation/ndctl/ndctl-setup-passphrase.txt
index 1219279b4c66..96f709b468fc 100644
--- a/Documentation/ndctl/ndctl-setup-passphrase.txt
+++ b/Documentation/ndctl/ndctl-setup-passphrase.txt
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-include::attrs.adoc[]
-
 ndctl-setup-passphrase(1)
 =========================
 
diff --git a/Documentation/ndctl/ndctl-update-passphrase.txt b/Documentation/ndctl/ndctl-update-passphrase.txt
index c7c1bfc8ab0b..591ce44ebc3e 100644
--- a/Documentation/ndctl/ndctl-update-passphrase.txt
+++ b/Documentation/ndctl/ndctl-update-passphrase.txt
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-include::attrs.adoc[]
-
 ndctl-update-passphrase(1)
 ==========================
 


^ permalink raw reply related

* [ndctl PATCH v3 06/16] ndctl/test: Move sector-mode to a different region
From: Dan Williams @ 2022-01-05 21:32 UTC (permalink / raw)
  To: vishal.l.verma; +Cc: nvdimm, linux-cxl
In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com>

Previously the largest region on the nfit_test.1 bus belonged to a BLK-mode
region. With the removal of BLK-mode support update the test to instead
find a suitable PMEM region to perform the checkout.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/sector-mode.sh |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/sector-mode.sh b/test/sector-mode.sh
index 439ef331adaf..f70b0f1786f4 100755
--- a/test/sector-mode.sh
+++ b/test/sector-mode.sh
@@ -19,11 +19,11 @@ reset
 reset1
 
 rc=1
-query=". | sort_by(.size) | reverse | .[0].dev"
-NAMESPACE=$($NDCTL list -b $NFIT_TEST_BUS1 -N | jq -r "$query")
-REGION=$($NDCTL list -R --namespace=$NAMESPACE | jq -r "(.[]) | .dev")
+query=". | sort_by(.available_size) | reverse | .[0].dev"
+REGION=$($NDCTL list -R -b $NFIT_TEST_BUS1 | jq -r "$query")
 echo 0 > /sys/bus/nd/devices/$REGION/read_only
-$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m sector -f -l 4K
+echo $ALIGN_SIZE > /sys/bus/nd/devices/$REGION/align
+NAMESPACE=$($NDCTL create-namespace --no-autolabel -r $REGION -m sector -f -l 4K | jq -r ".dev")
 $NDCTL create-namespace --no-autolabel -e $NAMESPACE -m dax -f -a $ALIGN_SIZE
 $NDCTL create-namespace --no-autolabel -e $NAMESPACE -m sector -f -l 4K
 


^ permalink raw reply related

* Re: [bug] GNOME loses all settings following failure to resume from suspend
From: Hugo Mills @ 2022-01-05 21:31 UTC (permalink / raw)
  To: Filipe Manana; +Cc: Chris Murphy, Btrfs BTRFS, Josef Bacik
In-Reply-To: <CAL3q7H4ofLVoGA3YC6M8gdBuW9g2W-C644gXgr9Z+r4MZBJZGA@mail.gmail.com>

On Wed, Jan 05, 2022 at 08:38:37PM +0000, Filipe Manana wrote:
> On Wed, Jan 5, 2022 at 6:34 PM Hugo Mills <hugo@carfax.org.uk> wrote:
> >
> >    Hi, Filipe,
> >
> > On Wed, Jan 05, 2022 at 06:04:38PM +0000, Filipe Manana wrote:
> > > I don't think I have a wiki account enabled, but I'll see if I get that
> > > updated soon.
> >
> >    If you can't (or don't want to), feel free to put the text you want
> > to replace it with here, and I'll update the wiki for you...
> 
> Hi Hugo,
> 
> That would be great.
> I don't have a concrete text, but as you are a native english speaker,
> a version from you would sound better :)
> 
> Perhaps just mention that as of kernel 3.17 (and maybe point to that
> commit too), the behaviour is no longer guaranteed, and we can end up
> getting a file of 0 bytes.

   I'd rather not reinforce the wrong usage with an example of it. :)
Better to document the correct usage...

> So an explicit fsync on the file is needed (just like ext4 and other
> filesystems).

   At what point in the process does the fsync need to be done?
Before/after/instead of the sync?

   Hugo.

-- 
Hugo Mills             | Geek, n.:
hugo@... carfax.org.uk | Circus sideshow performer specialising in the eating
http://carfax.org.uk/  | of live animals.
PGP: E2AB1DE4          |                                                   OED

^ permalink raw reply

* Re: [RFC PATCH 2/8] media: i2c: ov6650: Drop implementation of .set_mbus_config()
From: Janusz Krzysztofik @ 2022-01-05 21:31 UTC (permalink / raw)
  To: Sakari Ailus, Laurent Pinchart
  Cc: Linux Media Mailing List, linux-renesas-soc, Hans Verkuil,
	Kieran Bingham, Jacopo Mondi, Niklas Söderlund,
	Tomi Valkeinen
In-Reply-To: <YdX9ZaFJVSVrh41A@pendragon.ideasonboard.com>

Hi Laurent,

On Wednesday, 5 January 2022 21:19:49 CET Laurent Pinchart wrote:
> Hi Sakari,
>
> On Wed, Jan 05, 2022 at 08:04:24PM +0200, Sakari Ailus wrote:
> > On Mon, Jan 03, 2022 at 06:24:08PM +0200, Laurent Pinchart wrote:
> > > The subdev .set_mbus_config() operation is deprecated. No code in the
> > > kernel calls it, so drop its implementation from the ov6650 driver.
> > >
> > > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> > > ---
> > >  drivers/media/i2c/ov6650.c | 37 -------------------------------------
> > >  1 file changed, 37 deletions(-)
> > >
> > > diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c
> > > index f67412150b16..455a627e35a0 100644
> > > --- a/drivers/media/i2c/ov6650.c
> > > +++ b/drivers/media/i2c/ov6650.c
> > > @@ -944,42 +944,6 @@ static int ov6650_get_mbus_config(struct v4l2_subdev *sd,
> > >   return 0;
> > >  }
> > >
> > > -/* Alter bus settings on camera side */
> > > -static int ov6650_set_mbus_config(struct v4l2_subdev *sd,
> > > -                           unsigned int pad,
> > > -                           struct v4l2_mbus_config *cfg)
> > > -{
> > > - struct i2c_client *client = v4l2_get_subdevdata(sd);
> > > - int ret = 0;
> > > -
> > > - if (cfg->flags & V4L2_MBUS_PCLK_SAMPLE_RISING)
> > > -         ret = ov6650_reg_rmw(client, REG_COMJ, COMJ_PCLK_RISING, 0);
> > > - else if (cfg->flags & V4L2_MBUS_PCLK_SAMPLE_FALLING)
> > > -         ret = ov6650_reg_rmw(client, REG_COMJ, 0, COMJ_PCLK_RISING);
> >
> > I think this configuration should come from the endpoint which the driver
> > currently does not parse. In fact, there are no even DT bindings for the
> > device.
>
> There's also no OF match table. While this isn't strictly required, it
> may indicate that the sensor hasn't been tested much on DT-based
> systems.
>
> I agree that the configuration should come from the device tree, but I
> can't test that, so I'm tempted to let someone else implement it if the
> driver is actually still in use (I can also write a patch if someone can
> test it).

This driver was used with omap1_camera, removed from the tree a few years
ago by Hans, despite my attempts to refresh it.  I tried to keep ov6650
updated but I gave up due to lack of response to my submissions.  That also
blocked my attempts to rework and reintroduce omap1_camera.

I think I'm still able to update my local (v4l2, non-mc) version of
omap1_camera to the extent required to test any changes to ov6650.
However, the OMAP1 platform does not support DT, and will probably never
do.  Then,  I think that it makes sense to spend my time on that only if
you (media maintainers) are not going to depreciate non-DT support any
soon.  Are you?

Thanks,
Janusz


>
> > I wonder what kind of environment it is used in --- assuming it works
> > somewhere.
> >
> > > - if (ret)
> > > -         return ret;
> > > -
> > > - if (cfg->flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)
> > > -         ret = ov6650_reg_rmw(client, REG_COMF, COMF_HREF_LOW, 0);
> > > - else if (cfg->flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
> > > -         ret = ov6650_reg_rmw(client, REG_COMF, 0, COMF_HREF_LOW);
> > > - if (ret)
> > > -         return ret;
> > > -
> > > - if (cfg->flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH)
> > > -         ret = ov6650_reg_rmw(client, REG_COMJ, COMJ_VSYNC_HIGH, 0);
> > > - else if (cfg->flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)
> > > -         ret = ov6650_reg_rmw(client, REG_COMJ, 0, COMJ_VSYNC_HIGH);
> > > - if (ret)
> > > -         return ret;
> > > -
> > > - /*
> > > -  * Update the configuration to report what is actually applied to
> > > -  * the hardware.
> > > -  */
> > > - return ov6650_get_mbus_config(sd, pad, cfg);
> > > -}
> > > -
> > >  static const struct v4l2_subdev_video_ops ov6650_video_ops = {
> > >   .s_stream       = ov6650_s_stream,
> > >   .g_frame_interval = ov6650_g_frame_interval,
> > > @@ -993,7 +957,6 @@ static const struct v4l2_subdev_pad_ops ov6650_pad_ops = {
> > >   .get_fmt        = ov6650_get_fmt,
> > >   .set_fmt        = ov6650_set_fmt,
> > >   .get_mbus_config = ov6650_get_mbus_config,
> > > - .set_mbus_config = ov6650_set_mbus_config,
> > >  };
> > >
> > >  static const struct v4l2_subdev_ops ov6650_subdev_ops = {
>
>

^ permalink raw reply

* [PATCH v2 05/18] pnv_phb4.c: check if root port exists in rc_config functions
From: Daniel Henrique Barboza @ 2022-01-05 21:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: danielhb413, qemu-ppc, clg, david
In-Reply-To: <20220105212338.49899-1-danielhb413@gmail.com>

pnv_phb4_rc_config_read() and pnv_phb4_rc_config_write() are asserting
the existence of the root port. The root port is now optional, and there
will be cases where a pnv-phb4 device won't have a root port attached.

Instead of asserting, check if the root port exists before read/writing
into it.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
 hw/pci-host/pnv_phb4.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index 14827f8464..83dedc878a 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -152,7 +152,10 @@ static void pnv_phb4_rc_config_write(PnvPHB4 *phb, unsigned off,
     }
 
     pdev = pci_find_device(pci->bus, 0, 0);
-    assert(pdev);
+    if (!pdev) {
+        phb_error(phb, "rc_config_write device not found\n");
+        return;
+    }
 
     pci_host_config_write_common(pdev, off, PHB_RC_CONFIG_SIZE,
                                  bswap32(val), 4);
@@ -171,7 +174,10 @@ static uint64_t pnv_phb4_rc_config_read(PnvPHB4 *phb, unsigned off,
     }
 
     pdev = pci_find_device(pci->bus, 0, 0);
-    assert(pdev);
+    if (!pdev) {
+        phb_error(phb, "rc_config_read device not found\n");
+        return ~0ull;
+    }
 
     val = pci_host_config_read_common(pdev, off, PHB_RC_CONFIG_SIZE, 4);
     return bswap32(val);
-- 
2.33.1



^ permalink raw reply related

* [ndctl PATCH v3 08/16] ndctl/test: Fix support for missing dax_pmem_compat module
From: Dan Williams @ 2022-01-05 21:32 UTC (permalink / raw)
  To: vishal.l.verma; +Cc: nvdimm, linux-cxl
In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com>

The kernel is moving to drop CONFIG_DEV_DAX_PMEM_COMPAT. Update
ndctl_test_init() to not error out if dax_pmem_compat is missing. It seems
that the original implementation of support for missing dax_pmem_compat was
broken, or since that time newer versions of kmod_module_new_from_name() no
longer fail when the module is missing.

Fixes: b7991dbc22f3 ("ndctl/test: Relax dax_pmem_compat requirement")
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/core.c |   25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/test/core.c b/test/core.c
index dc1405d75c49..5d1aa23723f1 100644
--- a/test/core.c
+++ b/test/core.c
@@ -120,7 +120,6 @@ int ndctl_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
 		"nfit",
 		"device_dax",
 		"dax_pmem",
-		"dax_pmem_core",
 		"dax_pmem_compat",
 		"libnvdimm",
 		"nd_btt",
@@ -180,29 +179,27 @@ int ndctl_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
 		/*
 		 * Skip device-dax bus-model modules on pre-v5.1
 		 */
-		if ((strcmp(name, "dax_pmem_core") == 0
-				|| strcmp(name, "dax_pmem_compat") == 0)
-				&& !ndctl_test_attempt(test,
-					KERNEL_VERSION(5, 1, 0)))
+		if ((strcmp(name, "dax_pmem_compat") == 0) &&
+		    !ndctl_test_attempt(test, KERNEL_VERSION(5, 1, 0)))
 			continue;
 
 retry:
 		rc = kmod_module_new_from_name(*ctx, name, mod);
-
-		/*
-		 * dax_pmem_compat is not required, missing is ok,
-		 * present-but-production is not ok.
-		 */
-		if (rc && strcmp(name, "dax_pmem_compat") == 0)
-			continue;
-
 		if (rc) {
-			log_err(&log_ctx, "%s.ko: missing\n", name);
+			log_err(&log_ctx, "failed to interrogate %s.ko\n",
+				name);
 			break;
 		}
 
 		path = kmod_module_get_path(*mod);
 		if (!path) {
+			/*
+			 * dax_pmem_compat is not required, missing is
+			 * ok, present-but-production is not ok.
+			 */
+			if (strcmp(name, "dax_pmem_compat") == 0)
+				continue;
+
 			if (family != NVDIMM_FAMILY_INTEL &&
 			    (strcmp(name, "nfit") == 0 ||
 			     strcmp(name, "nd_e820") == 0))


^ permalink raw reply related


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