Таможенная логистика

2019-11-04 Thread Jana
Таможенные риски. Как избежать "проблем на таможне"

Место и дата проведения: 13-14 ноября.

Посетив данную программу, Вы получите необходимые знания для эффективного 
взаимодействия с таможенной службой Украины. Познакомитесь с изменениями во ВЭД 
после проведения таможенной реформы, узнаете место таможенных органов в системе 
ФСУ и перспективы развития таможенного дела, соглашение про ассоциацию между 
Украиной и ЕС - перспективы для бизнеса и практические условия применения норм 
соглашения. Повысите эффективность работы вашего предприятия, применив 
полученную информацию на практике. 

Доклад: 

1. Таможенные органы в системе государственной Фискальной службы Украины 
2. Порядок оформления товаров и условия выполнения таможенных формальностей 
3. Внешнеэкономическая деятельность. Тарифные методы регулирования ВЭД 
4. Внешнеэкономическая деятельность. Нетарифные методы регулирования ВЭД 
5. Соглашение про Ассоциацию между Украиной и ЕС. Новые возможности для бизнеса 

6. Страна происхождения товаров. Практические условия применения норм 
соглашения об Ассоциации между Украиной и ЕС 
7. Система Таможенных Рисков (АСАУР). Таможенный ПОСТ-АУДИ 
8. Что будет на таможне завтра. Как быть готовым к нововведениям. Плюсы и 
минусы 

Новости

Читать...

Новости туризма

Читать...

Интернет

Читать...

--
С уважением, 
Ника Евгеньевна
email-маркетолог
Web: http://pick.in.ua/

Вы получили данное письмо, так как подписаны на рассылку. Если письмо попало к 
Вам по ошибке, Вы можете
Отписаться от подписки. или пожаловаться на Spam
List-Unsubscribe from the newsletter or complain about Spam!
___
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-le...@lists.01.org


[ndctl PATCH 2/2] ndctl/namespace: For enable-namespace all, don't count no-op namespaces

2019-11-04 Thread Vishal Verma
When ndctl-enable-namespace is called for namespaces that are already
enabled, it shouldn't report that a positive number of namespaces were
enabled. Check whether the namespace is enabled, and if so, omit it from
the 'processed' count.

Since the indentation-heavy section for ACTION_ENABLE is getting larger
than a simgle libndctl call, break it out into its own namespace_enable()
helper.

Cc: Dan Williams 
Signed-off-by: Vishal Verma 
---
 ndctl/namespace.c | 26 ++
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index ed0421b..cebc312 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -961,6 +961,20 @@ out:
return rc;
 }
 
+static int namespace_enable(struct ndctl_namespace *ndns)
+{
+   if (ndctl_namespace_is_enabled(ndns))
+   return 1;
+
+   if (ndctl_namespace_is_configuration_idle(ndns)) {
+   debug("%s: skip seed namespace\n",
+   ndctl_namespace_get_devname(ndns));
+   return 1;
+   }
+
+   return ndctl_namespace_enable(ndns);
+}
+
 static int enable_labels(struct ndctl_region *region)
 {
int mappings = ndctl_region_get_mappings(region);
@@ -1401,16 +1415,12 @@ static int do_xaction_namespace(const char *namespace,
(*processed)++;
break;
case ACTION_ENABLE:
-   if 
(ndctl_namespace_is_configuration_idle(ndns)) {
-   debug("%s: skip seed 
namespace\n",
-   
ndctl_namespace_get_devname(ndns));
-   continue;
-   }
-   rc = ndctl_namespace_enable(ndns);
-   if (rc >= 0) {
+   rc = namespace_enable(ndns);
+   if (rc == 0)
(*processed)++;
+   /* return success if skipped */
+   if (rc > 0)
rc = 0;
-   }
break;
case ACTION_DESTROY:
rc = namespace_destroy(region, ndns);
-- 
2.20.1
___
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-le...@lists.01.org


[ndctl PATCH 1/2] ndctl/namespace: skip seed namespaces for 'enable-namespace'

2019-11-04 Thread Vishal Verma
Performing 'ndctl enable-namespace all' results in ndctl going through a
number of seed namespaces, one per region, and trying to enable them,
which fails as expected. This results in error messages like the
following, which are almost always going to be present, and are almost
always pointless:

  $ sudo ndctl enable-namespace all
  libndctl: ndctl_namespace_enable: namespace3.0: failed to enable
  libndctl: ndctl_namespace_enable: namespace5.0: failed to enable
  error enabling namespaces: No such device or address
  enabled 5 namespaces

Using the new 'ndctl_namespace_is_configuration_idle()' API to determine
whether a given namespace might be a 'seed' namespace, we can avoid
these error messages.

Ad a debug message gated behind the verbose option that prints when a
namespace is skipped when it it detected as a 'seed'.

Link: https://github.com/pmem/ndctl/issues/119
Cc: Dan Williams 
Reported-by: Aneesh Kumar K.V 
Signed-off-by: Vishal Verma 
---
 ndctl/namespace.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index a07d7e2..ed0421b 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -1401,6 +1401,11 @@ static int do_xaction_namespace(const char *namespace,
(*processed)++;
break;
case ACTION_ENABLE:
+   if 
(ndctl_namespace_is_configuration_idle(ndns)) {
+   debug("%s: skip seed 
namespace\n",
+   
ndctl_namespace_get_devname(ndns));
+   continue;
+   }
rc = ndctl_namespace_enable(ndns);
if (rc >= 0) {
(*processed)++;
-- 
2.20.1
___
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-le...@lists.01.org


[ndctl PATCH v4 2/2] ndctl/namespace: introduce ndctl_namespace_is_configuration_idle()

2019-11-04 Thread Vishal Verma
The motivation for this change is that we want to refrain from
(re)configuring what appear to be partially configured namespaces.
Namespaces may end up in a state that looks partially configured when
the kernel isn't able to enable a namespace due to mismatched
PAGE_SIZE expectations. In such cases, ndctl should not treat those
as unconfigured 'seed' namespaces, and reuse them.

Add a new ndctl_namespace_is_configuration_idle API, whish tests whether a
namespace is active, and whether it is partially configured. If neither
are true, then it can be used for (re)configuration. Additionally, deal
with the corner case of ND_DEVICE_NAMESPACE_IO (legacy PMEM) namespaces
which always appear as configured, since their size cannot be changed,
but they are also always re-configurable.

Use this API in namespace_reconfig() and namespace_create() to enable
this partial configuration detection.

Cc: Dan Williams 
Reported-by: Aneesh Kumar K.V 
Signed-off-by: Vishal Verma 
---

Changes in v4:
- Patch 1 was broken - one of the instances of the _is_active conversion
  flipped the polarity. Patch 2 fixed it, so the breakage would've been
  limited to a future bisect. This revision fixes it up so it is always
  correct.

Changes in v3:
- Remove stray leftovers in sysfs.{c,h} and namespace_is_writable() from
  libndctl.c

Changes in v2:
- Remove sysfs_attr_writable, and just check for the nstype of
  ND_DEVICE_NAMESPACE_IO (Dan)
- Rename ndctl_namespace_is_configurable to
  ndctl_namespace_is_configuration_idle (Dan)

 ndctl/lib/libndctl.c   | 21 +
 ndctl/lib/libndctl.sym |  4 
 ndctl/libndctl.h   |  1 +
 ndctl/namespace.c  |  6 +++---
 4 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 6596f94..d6a2800 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -4182,6 +4182,27 @@ NDCTL_EXPORT int ndctl_namespace_is_configured(struct 
ndctl_namespace *ndns)
}
 }
 
+/*
+ * Check if a given 'seed' namespace is ok to configure.
+ * If a size or uuid is present, it is considered not configuration-idle,
+ * except in the case of legacy (ND_DEVICE_NAMESPACE_IO) namespaces. In
+ * that case, the size is never zero, but the namespace can still be
+ * reconfigured.
+ */
+NDCTL_EXPORT int ndctl_namespace_is_configuration_idle(
+   struct ndctl_namespace *ndns)
+{
+   if (ndctl_namespace_is_active(ndns))
+   return 0;
+   if (ndctl_namespace_is_configured(ndns)) {
+   if (ndctl_namespace_get_type(ndns) == ND_DEVICE_NAMESPACE_IO)
+   return 1;
+   return 0;
+   }
+   /* !active and !configured is configuration-idle */
+   return 1;
+}
+
 NDCTL_EXPORT void ndctl_namespace_get_uuid(struct ndctl_namespace *ndns, 
uuid_t uu)
 {
memcpy(uu, ndns->uuid, sizeof(uuid_t));
diff --git a/ndctl/lib/libndctl.sym b/ndctl/lib/libndctl.sym
index c93c1ee..4e76778 100644
--- a/ndctl/lib/libndctl.sym
+++ b/ndctl/lib/libndctl.sym
@@ -423,3 +423,7 @@ LIBNDCTL_21 {
 LIBNDCTL_22 {
ndctl_dimm_security_is_frozen;
 } LIBNDCTL_21;
+
+LIBNDCTL_23 {
+   ndctl_namespace_is_configuration_idle;
+} LIBNDCTL_22;
diff --git a/ndctl/libndctl.h b/ndctl/libndctl.h
index db398b3..9a53049 100644
--- a/ndctl/libndctl.h
+++ b/ndctl/libndctl.h
@@ -491,6 +491,7 @@ int ndctl_namespace_disable_safe(struct ndctl_namespace 
*ndns);
 bool ndctl_namespace_is_active(struct ndctl_namespace *ndns);
 int ndctl_namespace_is_valid(struct ndctl_namespace *ndns);
 int ndctl_namespace_is_configured(struct ndctl_namespace *ndns);
+int ndctl_namespace_is_configuration_idle(struct ndctl_namespace *ndns);
 int ndctl_namespace_delete(struct ndctl_namespace *ndns);
 int ndctl_namespace_set_uuid(struct ndctl_namespace *ndns, uuid_t uu);
 void ndctl_namespace_get_uuid(struct ndctl_namespace *ndns, uuid_t uu);
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 8d1044a..a07d7e2 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -779,7 +779,7 @@ static struct ndctl_namespace *region_get_namespace(struct 
ndctl_region *region)
/* prefer the 0th namespace if it is idle */
ndctl_namespace_foreach(region, ndns)
if (ndctl_namespace_get_id(ndns) == 0
-   && !ndctl_namespace_is_active(ndns))
+   && ndctl_namespace_is_configuration_idle(ndns))
return ndns;
return ndctl_region_get_namespace_seed(region);
 }
@@ -819,7 +819,7 @@ static int namespace_create(struct ndctl_region *region)
p.size = available;
 
ndns = region_get_namespace(region);
-   if (!ndns || ndctl_namespace_is_active(ndns)) {
+   if (!ndns || !ndctl_namespace_is_configuration_idle(ndns)) {
debug("%s: no %s namespace seed\n", devname,
ndns ? "idle" : "available");
return -EAGAIN;
@@ -1066,7 +1066,7 @@ static int 

[ndctl PATCH v4 1/2] ndctl/namespace: remove open coded is_namespace_active()

2019-11-04 Thread Vishal Verma
Replace the open coded namespace active check with the one provided by
libndctl - ndctl_namespace_is_active().

is_namespace_active() additionally checked for a non-NULL 'ndns', which
the libndctl API doesn't do. However, all the callers either performed
that check themselves, or made prior assumptions about ndns being valid
by dereferencing it earlier.

Cc: Dan Williams 
Signed-off-by: Vishal Verma 
---
 ndctl/namespace.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 7fb0007..8d1044a 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -453,14 +453,6 @@ static int setup_namespace(struct ndctl_region *region,
return rc;
 }
 
-static int is_namespace_active(struct ndctl_namespace *ndns)
-{
-   return ndns && (ndctl_namespace_is_enabled(ndns)
-   || ndctl_namespace_get_pfn(ndns)
-   || ndctl_namespace_get_dax(ndns)
-   || ndctl_namespace_get_btt(ndns));
-}
-
 /*
  * validate_namespace_options - init parameters for setup_namespace
  * @region: parent of the namespace to create / reconfigure
@@ -787,7 +779,7 @@ static struct ndctl_namespace *region_get_namespace(struct 
ndctl_region *region)
/* prefer the 0th namespace if it is idle */
ndctl_namespace_foreach(region, ndns)
if (ndctl_namespace_get_id(ndns) == 0
-   && !is_namespace_active(ndns))
+   && !ndctl_namespace_is_active(ndns))
return ndns;
return ndctl_region_get_namespace_seed(region);
 }
@@ -827,7 +819,7 @@ static int namespace_create(struct ndctl_region *region)
p.size = available;
 
ndns = region_get_namespace(region);
-   if (!ndns || is_namespace_active(ndns)) {
+   if (!ndns || ndctl_namespace_is_active(ndns)) {
debug("%s: no %s namespace seed\n", devname,
ndns ? "idle" : "available");
return -EAGAIN;
@@ -1074,7 +1066,7 @@ static int namespace_reconfig(struct ndctl_region *region,
}
 
ndns = region_get_namespace(region);
-   if (!ndns || is_namespace_active(ndns)) {
+   if (!ndns || ndctl_namespace_is_active(ndns)) {
debug("%s: no %s namespace seed\n",
ndctl_region_get_devname(region),
ndns ? "idle" : "available");
-- 
2.20.1
___
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-le...@lists.01.org


[ndctl PATCH v3 1/2] ndctl/namespace: remove open coded is_namespace_active()

2019-11-04 Thread Vishal Verma
Replace the open coded namespace active check with the one provided by
libndctl - ndctl_namespace_is_active().

is_namespace_active() additionally checked for a non-NULL 'ndns', which
the libndctl API doesn't do. However, all the callers either performed
that check themselves, or made prior assumptions about ndns being valid
by dereferencing it earlier.

Cc: Dan Williams 
Signed-off-by: Vishal Verma 
---
 ndctl/namespace.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 7fb0007..ccd46d0 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -453,14 +453,6 @@ static int setup_namespace(struct ndctl_region *region,
return rc;
 }
 
-static int is_namespace_active(struct ndctl_namespace *ndns)
-{
-   return ndns && (ndctl_namespace_is_enabled(ndns)
-   || ndctl_namespace_get_pfn(ndns)
-   || ndctl_namespace_get_dax(ndns)
-   || ndctl_namespace_get_btt(ndns));
-}
-
 /*
  * validate_namespace_options - init parameters for setup_namespace
  * @region: parent of the namespace to create / reconfigure
@@ -787,7 +779,7 @@ static struct ndctl_namespace *region_get_namespace(struct 
ndctl_region *region)
/* prefer the 0th namespace if it is idle */
ndctl_namespace_foreach(region, ndns)
if (ndctl_namespace_get_id(ndns) == 0
-   && !is_namespace_active(ndns))
+   && !ndctl_namespace_is_active(ndns))
return ndns;
return ndctl_region_get_namespace_seed(region);
 }
@@ -827,7 +819,7 @@ static int namespace_create(struct ndctl_region *region)
p.size = available;
 
ndns = region_get_namespace(region);
-   if (!ndns || is_namespace_active(ndns)) {
+   if (!ndns || ndctl_namespace_is_active(ndns)) {
debug("%s: no %s namespace seed\n", devname,
ndns ? "idle" : "available");
return -EAGAIN;
@@ -1074,7 +1066,7 @@ static int namespace_reconfig(struct ndctl_region *region,
}
 
ndns = region_get_namespace(region);
-   if (!ndns || is_namespace_active(ndns)) {
+   if (!ndns || !ndctl_namespace_is_active(ndns)) {
debug("%s: no %s namespace seed\n",
ndctl_region_get_devname(region),
ndns ? "idle" : "available");
-- 
2.20.1
___
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-le...@lists.01.org


[ndctl PATCH v3 2/2] ndctl/namespace: introduce ndctl_namespace_is_configuration_idle()

2019-11-04 Thread Vishal Verma
The motivation for this change is that we want to refrain from
(re)configuring what appear to be partially configured namespaces.
Namespaces may end up in a state that looks partially configured when
the kernel isn't able to enable a namespace due to mismatched
PAGE_SIZE expectations. In such cases, ndctl should not treat those
as unconfigured 'seed' namespaces, and reuse them.

Add a new ndctl_namespace_is_configuration_idle API, whish tests whether a
namespace is active, and whether it is partially configured. If neither
are true, then it can be used for (re)configuration. Additionally, deal
with the corner case of ND_DEVICE_NAMESPACE_IO (legacy PMEM) namespaces
which always appear as configured, since their size cannot be changed,
but they are also always re-configurable.

Use this API in namespace_reconfig() and namespace_create() to enable
this partial configuration detection.

Cc: Dan Williams 
Reported-by: Aneesh Kumar K.V 
Signed-off-by: Vishal Verma 
---

Changes in v3:
- Remove stray leftovers in sysfs.{c,h} and namespace_is_writable() from
  libndctl.c

Changes in v2:
- Remove sysfs_attr_writable, and just check for the nstype of
  ND_DEVICE_NAMESPACE_IO (Dan)
- Rename ndctl_namespace_is_configurable to
  ndctl_namespace_is_configuration_idle (Dan)


 ndctl/lib/libndctl.c   | 21 +
 ndctl/lib/libndctl.sym |  4 
 ndctl/libndctl.h   |  1 +
 ndctl/namespace.c  |  6 +++---
 4 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 6596f94..d6a2800 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -4182,6 +4182,27 @@ NDCTL_EXPORT int ndctl_namespace_is_configured(struct 
ndctl_namespace *ndns)
}
 }
 
+/*
+ * Check if a given 'seed' namespace is ok to configure.
+ * If a size or uuid is present, it is considered not configuration-idle,
+ * except in the case of legacy (ND_DEVICE_NAMESPACE_IO) namespaces. In
+ * that case, the size is never zero, but the namespace can still be
+ * reconfigured.
+ */
+NDCTL_EXPORT int ndctl_namespace_is_configuration_idle(
+   struct ndctl_namespace *ndns)
+{
+   if (ndctl_namespace_is_active(ndns))
+   return 0;
+   if (ndctl_namespace_is_configured(ndns)) {
+   if (ndctl_namespace_get_type(ndns) == ND_DEVICE_NAMESPACE_IO)
+   return 1;
+   return 0;
+   }
+   /* !active and !configured is configuration-idle */
+   return 1;
+}
+
 NDCTL_EXPORT void ndctl_namespace_get_uuid(struct ndctl_namespace *ndns, 
uuid_t uu)
 {
memcpy(uu, ndns->uuid, sizeof(uuid_t));
diff --git a/ndctl/lib/libndctl.sym b/ndctl/lib/libndctl.sym
index c93c1ee..4e76778 100644
--- a/ndctl/lib/libndctl.sym
+++ b/ndctl/lib/libndctl.sym
@@ -423,3 +423,7 @@ LIBNDCTL_21 {
 LIBNDCTL_22 {
ndctl_dimm_security_is_frozen;
 } LIBNDCTL_21;
+
+LIBNDCTL_23 {
+   ndctl_namespace_is_configuration_idle;
+} LIBNDCTL_22;
diff --git a/ndctl/libndctl.h b/ndctl/libndctl.h
index db398b3..9a53049 100644
--- a/ndctl/libndctl.h
+++ b/ndctl/libndctl.h
@@ -491,6 +491,7 @@ int ndctl_namespace_disable_safe(struct ndctl_namespace 
*ndns);
 bool ndctl_namespace_is_active(struct ndctl_namespace *ndns);
 int ndctl_namespace_is_valid(struct ndctl_namespace *ndns);
 int ndctl_namespace_is_configured(struct ndctl_namespace *ndns);
+int ndctl_namespace_is_configuration_idle(struct ndctl_namespace *ndns);
 int ndctl_namespace_delete(struct ndctl_namespace *ndns);
 int ndctl_namespace_set_uuid(struct ndctl_namespace *ndns, uuid_t uu);
 void ndctl_namespace_get_uuid(struct ndctl_namespace *ndns, uuid_t uu);
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index ccd46d0..a07d7e2 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -779,7 +779,7 @@ static struct ndctl_namespace *region_get_namespace(struct 
ndctl_region *region)
/* prefer the 0th namespace if it is idle */
ndctl_namespace_foreach(region, ndns)
if (ndctl_namespace_get_id(ndns) == 0
-   && !ndctl_namespace_is_active(ndns))
+   && ndctl_namespace_is_configuration_idle(ndns))
return ndns;
return ndctl_region_get_namespace_seed(region);
 }
@@ -819,7 +819,7 @@ static int namespace_create(struct ndctl_region *region)
p.size = available;
 
ndns = region_get_namespace(region);
-   if (!ndns || ndctl_namespace_is_active(ndns)) {
+   if (!ndns || !ndctl_namespace_is_configuration_idle(ndns)) {
debug("%s: no %s namespace seed\n", devname,
ndns ? "idle" : "available");
return -EAGAIN;
@@ -1066,7 +1066,7 @@ static int namespace_reconfig(struct ndctl_region *region,
}
 
ndns = region_get_namespace(region);
-   if (!ndns || !ndctl_namespace_is_active(ndns)) {
+   if (!ndns || !ndctl_namespace_is_configuration_idle(ndns)) {
 

Re: [ndctl PATCH v2 2/2] ndctl/namespace: introduce ndctl_namespace_is_configuration_idle()

2019-11-04 Thread Verma, Vishal L


On Mon, 2019-11-04 at 13:08 -0700, Vishal Verma wrote:
> 
> diff --git a/util/sysfs.c b/util/sysfs.c
> index 9f7bc1f..81cd055 100644
> --- a/util/sysfs.c
> +++ b/util/sysfs.c
> @@ -20,6 +20,7 @@
>  #include 
>  #include 
>  #include 
> +#include 

These are stray lines from the previous version, I'll resend removing
these. Sorry for the noise.

>  #include 
>  #include 
>  #include 
> diff --git a/util/sysfs.h b/util/sysfs.h
> index fb169c6..b2d28f1 100644
> --- a/util/sysfs.h
> +++ b/util/sysfs.h
> @@ -14,6 +14,7 @@
>  #define __UTIL_SYSFS_H__
>  
>  #include 
> +#include 
>  
>  typedef void *(*add_dev_fn)(void *parent, int id, const char *dev_path);
>  

___
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-le...@lists.01.org


[ndctl PATCH v2 1/2] ndctl/namespace: remove open coded is_namespace_active()

2019-11-04 Thread Vishal Verma
Replace the open coded namespace active check with the one provided by
libndctl - ndctl_namespace_is_active().

is_namespace_active() additionally checked for a non-NULL 'ndns', which
the libndctl API doesn't do. However, all the callers either performed
that check themselves, or made prior assumptions about ndns being valid
by dereferencing it earlier.

Cc: Dan Williams 
Signed-off-by: Vishal Verma 
---
 ndctl/namespace.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 7fb0007..ccd46d0 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -453,14 +453,6 @@ static int setup_namespace(struct ndctl_region *region,
return rc;
 }
 
-static int is_namespace_active(struct ndctl_namespace *ndns)
-{
-   return ndns && (ndctl_namespace_is_enabled(ndns)
-   || ndctl_namespace_get_pfn(ndns)
-   || ndctl_namespace_get_dax(ndns)
-   || ndctl_namespace_get_btt(ndns));
-}
-
 /*
  * validate_namespace_options - init parameters for setup_namespace
  * @region: parent of the namespace to create / reconfigure
@@ -787,7 +779,7 @@ static struct ndctl_namespace *region_get_namespace(struct 
ndctl_region *region)
/* prefer the 0th namespace if it is idle */
ndctl_namespace_foreach(region, ndns)
if (ndctl_namespace_get_id(ndns) == 0
-   && !is_namespace_active(ndns))
+   && !ndctl_namespace_is_active(ndns))
return ndns;
return ndctl_region_get_namespace_seed(region);
 }
@@ -827,7 +819,7 @@ static int namespace_create(struct ndctl_region *region)
p.size = available;
 
ndns = region_get_namespace(region);
-   if (!ndns || is_namespace_active(ndns)) {
+   if (!ndns || ndctl_namespace_is_active(ndns)) {
debug("%s: no %s namespace seed\n", devname,
ndns ? "idle" : "available");
return -EAGAIN;
@@ -1074,7 +1066,7 @@ static int namespace_reconfig(struct ndctl_region *region,
}
 
ndns = region_get_namespace(region);
-   if (!ndns || is_namespace_active(ndns)) {
+   if (!ndns || !ndctl_namespace_is_active(ndns)) {
debug("%s: no %s namespace seed\n",
ndctl_region_get_devname(region),
ndns ? "idle" : "available");
-- 
2.20.1
___
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-le...@lists.01.org


[ndctl PATCH v2 2/2] ndctl/namespace: introduce ndctl_namespace_is_configuration_idle()

2019-11-04 Thread Vishal Verma
The motivation for this change is that we want to refrain from
(re)configuring what appear to be partially configured namespaces.
Namespaces may end up in a state that looks partially configured when
the kernel isn't able to enable a namespace due to mismatched
PAGE_SIZE expectations. In such cases, ndctl should not treat those
as unconfigured 'seed' namespaces, and reuse them.

Add a new ndctl_namespace_is_configuration_idle API, whish tests whether a
namespace is active, and whether it is partially configured. If neither
are true, then it can be used for (re)configuration. Additionally, deal
with the corner case of ND_DEVICE_NAMESPACE_IO (legacy PMEM) namespaces
which always appear as configured, since their size cannot be changed,
but they are also always re-configurable.

Use this API in namespace_reconfig() and namespace_create() to enable
this partial configuration detection.

Cc: Dan Williams 
Reported-by: Aneesh Kumar K.V 
Signed-off-by: Vishal Verma 
---

Changes in v2:
- Remove sysfs_attr_writable, and just check for the nstype of
  ND_DEVICE_NAMESPACE_IO (Dan)
- Rename ndctl_namespace_is_configurable to
  ndctl_namespace_is_configuration_idle (Dan)

 ndctl/lib/libndctl.c   | 36 
 ndctl/lib/libndctl.sym |  4 
 ndctl/libndctl.h   |  1 +
 ndctl/namespace.c  |  6 +++---
 util/sysfs.c   |  1 +
 util/sysfs.h   |  1 +
 6 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 6596f94..663d09a 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -3985,6 +3985,21 @@ static void region_refresh_children(struct ndctl_region 
*region)
daxs_init(region);
 }
 
+static bool namespace_size_is_writeable(struct ndctl_namespace *ndns)
+{
+   struct ndctl_ctx *ctx = ndctl_namespace_get_ctx(ndns);
+   char *path = ndns->ndns_buf;
+   int len = ndns->buf_len;
+
+   if (snprintf(path, len, "%s/size", ndns->ndns_path) >= len) {
+   err(ctx, "%s: buffer too small!\n",
+   ndctl_namespace_get_devname(ndns));
+   return false;
+   }
+
+   return sysfs_attr_writable(ctx, path);
+}
+
 NDCTL_EXPORT bool ndctl_namespace_is_active(struct ndctl_namespace *ndns)
 {
struct ndctl_btt *btt = ndctl_namespace_get_btt(ndns);
@@ -4182,6 +4197,27 @@ NDCTL_EXPORT int ndctl_namespace_is_configured(struct 
ndctl_namespace *ndns)
}
 }
 
+/*
+ * Check if a given 'seed' namespace is ok to configure.
+ * If a size or uuid is present, it is considered not configuration-idle,
+ * except in the case of legacy (ND_DEVICE_NAMESPACE_IO) namespaces. In
+ * that case, the size is never zero, but the namespace can still be
+ * reconfigured.
+ */
+NDCTL_EXPORT int ndctl_namespace_is_configuration_idle(
+   struct ndctl_namespace *ndns)
+{
+   if (ndctl_namespace_is_active(ndns))
+   return 0;
+   if (ndctl_namespace_is_configured(ndns)) {
+   if (ndctl_namespace_get_type(ndns) == ND_DEVICE_NAMESPACE_IO)
+   return 1;
+   return 0;
+   }
+   /* !active and !configured is configuration-idle */
+   return 1;
+}
+
 NDCTL_EXPORT void ndctl_namespace_get_uuid(struct ndctl_namespace *ndns, 
uuid_t uu)
 {
memcpy(uu, ndns->uuid, sizeof(uuid_t));
diff --git a/ndctl/lib/libndctl.sym b/ndctl/lib/libndctl.sym
index c93c1ee..4e76778 100644
--- a/ndctl/lib/libndctl.sym
+++ b/ndctl/lib/libndctl.sym
@@ -423,3 +423,7 @@ LIBNDCTL_21 {
 LIBNDCTL_22 {
ndctl_dimm_security_is_frozen;
 } LIBNDCTL_21;
+
+LIBNDCTL_23 {
+   ndctl_namespace_is_configuration_idle;
+} LIBNDCTL_22;
diff --git a/ndctl/libndctl.h b/ndctl/libndctl.h
index db398b3..9a53049 100644
--- a/ndctl/libndctl.h
+++ b/ndctl/libndctl.h
@@ -491,6 +491,7 @@ int ndctl_namespace_disable_safe(struct ndctl_namespace 
*ndns);
 bool ndctl_namespace_is_active(struct ndctl_namespace *ndns);
 int ndctl_namespace_is_valid(struct ndctl_namespace *ndns);
 int ndctl_namespace_is_configured(struct ndctl_namespace *ndns);
+int ndctl_namespace_is_configuration_idle(struct ndctl_namespace *ndns);
 int ndctl_namespace_delete(struct ndctl_namespace *ndns);
 int ndctl_namespace_set_uuid(struct ndctl_namespace *ndns, uuid_t uu);
 void ndctl_namespace_get_uuid(struct ndctl_namespace *ndns, uuid_t uu);
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index ccd46d0..a07d7e2 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -779,7 +779,7 @@ static struct ndctl_namespace *region_get_namespace(struct 
ndctl_region *region)
/* prefer the 0th namespace if it is idle */
ndctl_namespace_foreach(region, ndns)
if (ndctl_namespace_get_id(ndns) == 0
-   && !ndctl_namespace_is_active(ndns))
+   && ndctl_namespace_is_configuration_idle(ndns))
return ndns;
return 

Re: [ndctl PATCH 2/2] ndctl/namespace: introduce ndctl_namespace_is_configurable()

2019-11-04 Thread Verma, Vishal L
On Mon, 2019-11-04 at 10:58 -0800, Dan Williams wrote:
> > 
> > > Also, how about 
> > > s/ndctl_namespace_is_configurable/ndctl_namespace_is_configuration_idle/?
> > > Because to me all namespaces are always "configurable", but some may
> > > have active non-default properties set.
> > 
> > Sounds reasonable, but how about ndctl_namespace_has_partial_config(),
> > which I think describes the situation better, and makes it
> > straightforward for a potential future --really-force (or -ff) option
> > where we might still want to blow away anything on this namespace and
> > reclaim it.
> 
> Does "_has_partial_config()" imply "_has_full_config()"? In other
> words, what ndctl cares about are namespaces that can effectively be
> used as seeds with no existing configuration parameters having been
> set. So "_is_configuration_idle()" seems unambiguous where
> "_has_partial_config()" does not.

Good point, I'll go with _is_configuration_idle()
___
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-le...@lists.01.org


Re: [ndctl PATCH 2/2] ndctl/namespace: introduce ndctl_namespace_is_configurable()

2019-11-04 Thread Dan Williams
On Mon, Nov 4, 2019 at 10:48 AM Verma, Vishal L
 wrote:
>
> On Mon, 2019-11-04 at 08:35 -0800, Dan Williams wrote:
> > On Fri, Nov 1, 2019 at 1:27 PM Vishal Verma  
> > wrote:
> > > The motivation for this change is that we want to refrain from
> > > (re)configuring what appear to be partially configured namespaces.
> > > Namespaces may end up in a state that looks partially configured when
> > > the kernel isn't able to enable a namespace due to mismatched
> > > PAGE_SIZE expectations. In such cases, ndctl should not treat those
> > > as unconfigured 'seed' namespaces, and reuse them.
> > >
> > > Add a new ndctl_namespace_is_configurable API, whish tests whether a
> > > namespaces is active, and whether it is partially configured. If neither
> > > are true, then it can be used for (re)configuration. Additionally, deal
> > > with the corner case of ND_DEVICE_NAMESPACE_IO (legacy PMEM) namespaces
> > > by testing whether the size attribute is read-only (which indicates such
> > > a namespace). Legacy namespaces always appear as configured, since their
> > > size cannot be changed, but they are also always re-configurable.
> > >
> > > Use this API in namespace_reconfig() and namespace_create() to enable
> > > this partial configuration detection.
> >
> > A couple comments I think it's probably sufficient to just check
> > for ND_DEVICE_NAMESPACE_IO as I don't anticipate we'll ever have more
> > than one namespace type with a read-only size attribute.
>
> Yep I did notice I could do that, but I decided to go to the source of
> it instead of adding another ND_DEVICE_NAMESPACE_IO assumption. Also I
> had already written sysfs_attr_writable() before I noticed that :)
> But there are already assumptions around ND_DEVICE_NAMESPACE_IO, so
> adding another one here is fine.
>
> > Also, how about 
> > s/ndctl_namespace_is_configurable/ndctl_namespace_is_configuration_idle/?
> > Because to me all namespaces are always "configurable", but some may
> > have active non-default properties set.
>
> Sounds reasonable, but how about ndctl_namespace_has_partial_config(),
> which I think describes the situation better, and makes it
> straightforward for a potential future --really-force (or -ff) option
> where we might still want to blow away anything on this namespace and
> reclaim it.

Does "_has_partial_config()" imply "_has_full_config()"? In other
words, what ndctl cares about are namespaces that can effectively be
used as seeds with no existing configuration parameters having been
set. So "_is_configuration_idle()" seems unambiguous where
"_has_partial_config()" does not.
___
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-le...@lists.01.org


Re: [ndctl PATCH 2/2] ndctl/namespace: introduce ndctl_namespace_is_configurable()

2019-11-04 Thread Verma, Vishal L
On Mon, 2019-11-04 at 08:35 -0800, Dan Williams wrote:
> On Fri, Nov 1, 2019 at 1:27 PM Vishal Verma  wrote:
> > The motivation for this change is that we want to refrain from
> > (re)configuring what appear to be partially configured namespaces.
> > Namespaces may end up in a state that looks partially configured when
> > the kernel isn't able to enable a namespace due to mismatched
> > PAGE_SIZE expectations. In such cases, ndctl should not treat those
> > as unconfigured 'seed' namespaces, and reuse them.
> > 
> > Add a new ndctl_namespace_is_configurable API, whish tests whether a
> > namespaces is active, and whether it is partially configured. If neither
> > are true, then it can be used for (re)configuration. Additionally, deal
> > with the corner case of ND_DEVICE_NAMESPACE_IO (legacy PMEM) namespaces
> > by testing whether the size attribute is read-only (which indicates such
> > a namespace). Legacy namespaces always appear as configured, since their
> > size cannot be changed, but they are also always re-configurable.
> > 
> > Use this API in namespace_reconfig() and namespace_create() to enable
> > this partial configuration detection.
> 
> A couple comments I think it's probably sufficient to just check
> for ND_DEVICE_NAMESPACE_IO as I don't anticipate we'll ever have more
> than one namespace type with a read-only size attribute.

Yep I did notice I could do that, but I decided to go to the source of
it instead of adding another ND_DEVICE_NAMESPACE_IO assumption. Also I
had already written sysfs_attr_writable() before I noticed that :)
But there are already assumptions around ND_DEVICE_NAMESPACE_IO, so
adding another one here is fine.

> Also, how about 
> s/ndctl_namespace_is_configurable/ndctl_namespace_is_configuration_idle/?
> Because to me all namespaces are always "configurable", but some may
> have active non-default properties set.

Sounds reasonable, but how about ndctl_namespace_has_partial_config(),
which I think describes the situation better, and makes it
straightforward for a potential future --really-force (or -ff) option
where we might still want to blow away anything on this namespace and
reclaim it.
___
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-le...@lists.01.org


Re: [PATCH 4/4] modpost: do not set ->preloaded for symbols from Module.symvers

2019-11-04 Thread Dan Williams
On Sun, Nov 3, 2019 at 10:43 PM Dan Williams  wrote:
>
> On Sun, Nov 3, 2019 at 7:12 PM Masahiro Yamada
>  wrote:
> >
> > On Sat, Nov 2, 2019 at 3:52 AM Jeff Moyer  wrote:
> > >
> > > Masahiro Yamada  writes:
> > >
> > > > On Fri, Nov 1, 2019 at 1:51 AM Jeff Moyer  wrote:
> > > >>
> > > >> Masahiro Yamada  writes:
> > > >>
> > > >> > Now that there is no overwrap between symbols from ELF files and
> > > >> > ones from Module.symvers.
> > > >> >
> > > >> > So, the 'exported twice' warning should be reported irrespective
> > > >> > of where the symbol in question came from. Only the exceptional case
> > > >> > is when __crc_ symbol appears before __ksymtab_. This
> > > >> > typically occurs for EXPORT_SYMBOL in .S files.
> > > >>
> > > >> Hi, Masahiro,
> > > >>
> > > >> After apply this patch, I get the following modpost warnings when 
> > > >> doing:
> > > >>
> > > >> $ make M=tools/tesing/nvdimm
> > > >> ...
> > > >>   Building modules, stage 2.
> > > >>   MODPOST 12 modules
> > > >> WARNING: tools/testing/nvdimm/libnvdimm: 'nvdimm_bus_lock' exported
> > > >> twice. Previous export was in drivers/nvdimm/libnvdimm.ko
> > > >> WARNING: tools/testing/nvdimm/libnvdimm: 'nvdimm_bus_unlock'
> > > >> exported twice. Previous export was in drivers/nvdimm/libnvdimm.ko
> > > >> WARNING: tools/testing/nvdimm/libnvdimm: 'is_nvdimm_bus_locked'
> > > >> exported twice. Previous export was in drivers/nvdimm/libnvdimm.ko
> > > >> WARNING: tools/testing/nvdimm/libnvdimm: 'devm_nvdimm_memremap'
> > > >> exported twice. Previous export was in drivers/nvdimm/libnvdimm.ko
> > > >> WARNING: tools/testing/nvdimm/libnvdimm: 'nd_fletcher64' exported 
> > > >> twice. Previous export was in drivers/nvdimm/libnvdimm.ko
> > > >> WARNING: tools/testing/nvdimm/libnvdimm: 'to_nd_desc' exported twice. 
> > > >> Previous export was in drivers/nvdimm/libnvdimm.ko
> > > >> WARNING: tools/testing/nvdimm/libnvdimm: 'to_nvdimm_bus_dev'
> > > >> exported twice. Previous export was in drivers/nvdimm/libnvdimm.ko
> > > >> ...
> > > >>
> > > >> There are a lot of these warnings.  :)
> > > >
> > > > These warnings are correct since
> > > > drivers/nvdimm/Makefile and
> > > > tools/testing/nvdimm/Kbuild
> > > > compile the same files.
> > >
> > > Yeah, but that's by design.  Is there a way to silence these warnings?
> > >
> > > -Jeff
> > >
> >
> > "rm -f Module.symvers; make M=tools/testing/nvdimm" ?
> >
> > I'd like the _design_ fixed though.
>
> This design is deliberate. The goal is to re-build the typical nvdimm
> modules, but link them against mocked version of core kernel symbols.
> This enables the nvdimm unit tests which have been there for years and
> pre-date Kunit. That said, deleting Module.symvers seems a simple
> enough workaround.

This workaround triggers:

  WARNING: Symbol version dump ./Module.symvers
   is missing; modules will have no dependencies and modversions.

Which is a regression from the previous working state.
___
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-le...@lists.01.org


Re: [ndctl PATCH 2/2] ndctl/namespace: introduce ndctl_namespace_is_configurable()

2019-11-04 Thread Dan Williams
On Fri, Nov 1, 2019 at 1:27 PM Vishal Verma  wrote:
>
> The motivation for this change is that we want to refrain from
> (re)configuring what appear to be partially configured namespaces.
> Namespaces may end up in a state that looks partially configured when
> the kernel isn't able to enable a namespace due to mismatched
> PAGE_SIZE expectations. In such cases, ndctl should not treat those
> as unconfigured 'seed' namespaces, and reuse them.
>
> Add a new ndctl_namespace_is_configurable API, whish tests whether a
> namespaces is active, and whether it is partially configured. If neither
> are true, then it can be used for (re)configuration. Additionally, deal
> with the corner case of ND_DEVICE_NAMESPACE_IO (legacy PMEM) namespaces
> by testing whether the size attribute is read-only (which indicates such
> a namespace). Legacy namespaces always appear as configured, since their
> size cannot be changed, but they are also always re-configurable.
>
> Use this API in namespace_reconfig() and namespace_create() to enable
> this partial configuration detection.

A couple comments I think it's probably sufficient to just check
for ND_DEVICE_NAMESPACE_IO as I don't anticipate we'll ever have more
than one namespace type with a read-only size attribute. Also, how
about s/ndctl_namespace_is_configurable/ndctl_namespace_is_configuration_idle/?
Because to me all namespaces are always "configurable", but some may
have active non-default properties set.
___
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-le...@lists.01.org