[PATCH] virtio pmem: fix async flush ordering
by Pankaj Gupta
Remove logic to create child bio in the async flush function which
causes child bio to get executed after parent bio 'pmem_make_request'
completes. This resulted in wrong ordering of REQ_PREFLUSH with the
data write request.
Instead we are performing flush from the parent bio to maintain the
correct order. Also, returning from function 'pmem_make_request' if
REQ_PREFLUSH returns an error.
Reported-by: Jeff Moyer <jmoyer(a)redhat.com>
Signed-off-by: Pankaj Gupta <pagupta(a)redhat.com>
---
drivers/acpi/nfit/core.c | 4 ++--
drivers/nvdimm/claim.c | 2 +-
drivers/nvdimm/nd.h | 2 +-
drivers/nvdimm/nd_virtio.c | 29 ++---------------------------
drivers/nvdimm/pmem.c | 14 ++++++++++----
drivers/nvdimm/region_devs.c | 6 +++---
drivers/nvdimm/virtio_pmem.c | 2 +-
drivers/nvdimm/virtio_pmem.h | 2 +-
include/linux/libnvdimm.h | 4 ++--
9 files changed, 23 insertions(+), 42 deletions(-)
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 14e68f202f81..afbd5e2b2ea8 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -2426,7 +2426,7 @@ static void write_blk_ctl(struct nfit_blk *nfit_blk, unsigned int bw,
offset = to_interleave_offset(offset, mmio);
writeq(cmd, mmio->addr.base + offset);
- nvdimm_flush(nfit_blk->nd_region, NULL);
+ nvdimm_flush(nfit_blk->nd_region);
if (nfit_blk->dimm_flags & NFIT_BLK_DCR_LATCH)
readq(mmio->addr.base + offset);
@@ -2475,7 +2475,7 @@ static int acpi_nfit_blk_single_io(struct nfit_blk *nfit_blk,
}
if (rw)
- nvdimm_flush(nfit_blk->nd_region, NULL);
+ nvdimm_flush(nfit_blk->nd_region);
rc = read_blk_stat(nfit_blk, lane) ? -EIO : 0;
return rc;
diff --git a/drivers/nvdimm/claim.c b/drivers/nvdimm/claim.c
index 2985ca949912..0fedb2fbfcbe 100644
--- a/drivers/nvdimm/claim.c
+++ b/drivers/nvdimm/claim.c
@@ -293,7 +293,7 @@ static int nsio_rw_bytes(struct nd_namespace_common *ndns,
}
memcpy_flushcache(nsio->addr + offset, buf, size);
- ret = nvdimm_flush(to_nd_region(ndns->dev.parent), NULL);
+ ret = nvdimm_flush(to_nd_region(ndns->dev.parent));
if (ret)
rc = ret;
diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h
index ee5c04070ef9..77d8b9f0c34a 100644
--- a/drivers/nvdimm/nd.h
+++ b/drivers/nvdimm/nd.h
@@ -155,7 +155,7 @@ struct nd_region {
struct badblocks bb;
struct nd_interleave_set *nd_set;
struct nd_percpu_lane __percpu *lane;
- int (*flush)(struct nd_region *nd_region, struct bio *bio);
+ int (*flush)(struct nd_region *nd_region);
struct nd_mapping mapping[0];
};
diff --git a/drivers/nvdimm/nd_virtio.c b/drivers/nvdimm/nd_virtio.c
index 10351d5b49fa..9604ba08a68a 100644
--- a/drivers/nvdimm/nd_virtio.c
+++ b/drivers/nvdimm/nd_virtio.c
@@ -35,7 +35,7 @@ void virtio_pmem_host_ack(struct virtqueue *vq)
EXPORT_SYMBOL_GPL(virtio_pmem_host_ack);
/* The request submission function */
-static int virtio_pmem_flush(struct nd_region *nd_region)
+int virtio_pmem_flush(struct nd_region *nd_region)
{
struct virtio_device *vdev = nd_region->provider_data;
struct virtio_pmem *vpmem = vdev->priv;
@@ -96,30 +96,5 @@ static int virtio_pmem_flush(struct nd_region *nd_region)
kfree(req_data);
return err;
};
-
-/* The asynchronous flush callback function */
-int async_pmem_flush(struct nd_region *nd_region, struct bio *bio)
-{
- /*
- * Create child bio for asynchronous flush and chain with
- * parent bio. Otherwise directly call nd_region flush.
- */
- if (bio && bio->bi_iter.bi_sector != -1) {
- struct bio *child = bio_alloc(GFP_ATOMIC, 0);
-
- if (!child)
- return -ENOMEM;
- bio_copy_dev(child, bio);
- child->bi_opf = REQ_PREFLUSH;
- child->bi_iter.bi_sector = -1;
- bio_chain(child, bio);
- submit_bio(child);
- return 0;
- }
- if (virtio_pmem_flush(nd_region))
- return -EIO;
-
- return 0;
-};
-EXPORT_SYMBOL_GPL(async_pmem_flush);
+EXPORT_SYMBOL_GPL(virtio_pmem_flush);
MODULE_LICENSE("GPL");
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index f9f76f6ba07b..b3ca641668a2 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -194,7 +194,13 @@ static blk_qc_t pmem_make_request(struct request_queue *q, struct bio *bio)
struct nd_region *nd_region = to_region(pmem);
if (bio->bi_opf & REQ_PREFLUSH)
- ret = nvdimm_flush(nd_region, bio);
+ ret = nvdimm_flush(nd_region);
+
+ if (ret) {
+ bio->bi_status = errno_to_blk_status(ret);
+ bio_endio(bio);
+ return BLK_QC_T_NONE;
+ }
do_acct = nd_iostat_start(bio, &start);
bio_for_each_segment(bvec, bio, iter) {
@@ -209,7 +215,7 @@ static blk_qc_t pmem_make_request(struct request_queue *q, struct bio *bio)
nd_iostat_end(bio, start);
if (bio->bi_opf & REQ_FUA)
- ret = nvdimm_flush(nd_region, bio);
+ ret = nvdimm_flush(nd_region);
if (ret)
bio->bi_status = errno_to_blk_status(ret);
@@ -549,14 +555,14 @@ static int nd_pmem_remove(struct device *dev)
sysfs_put(pmem->bb_state);
pmem->bb_state = NULL;
}
- nvdimm_flush(to_nd_region(dev->parent), NULL);
+ nvdimm_flush(to_nd_region(dev->parent));
return 0;
}
static void nd_pmem_shutdown(struct device *dev)
{
- nvdimm_flush(to_nd_region(dev->parent), NULL);
+ nvdimm_flush(to_nd_region(dev->parent));
}
static void nd_pmem_notify(struct device *dev, enum nvdimm_event event)
diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
index ef423ba1a711..cfd96a0d52f2 100644
--- a/drivers/nvdimm/region_devs.c
+++ b/drivers/nvdimm/region_devs.c
@@ -287,7 +287,7 @@ static ssize_t deep_flush_store(struct device *dev, struct device_attribute *att
return rc;
if (!flush)
return -EINVAL;
- rc = nvdimm_flush(nd_region, NULL);
+ rc = nvdimm_flush(nd_region);
if (rc)
return rc;
@@ -1079,14 +1079,14 @@ struct nd_region *nvdimm_volatile_region_create(struct nvdimm_bus *nvdimm_bus,
}
EXPORT_SYMBOL_GPL(nvdimm_volatile_region_create);
-int nvdimm_flush(struct nd_region *nd_region, struct bio *bio)
+int nvdimm_flush(struct nd_region *nd_region)
{
int rc = 0;
if (!nd_region->flush)
rc = generic_nvdimm_flush(nd_region);
else {
- if (nd_region->flush(nd_region, bio))
+ if (nd_region->flush(nd_region))
rc = -EIO;
}
diff --git a/drivers/nvdimm/virtio_pmem.c b/drivers/nvdimm/virtio_pmem.c
index 5e3d07b47e0c..a6234466674d 100644
--- a/drivers/nvdimm/virtio_pmem.c
+++ b/drivers/nvdimm/virtio_pmem.c
@@ -80,7 +80,7 @@ static int virtio_pmem_probe(struct virtio_device *vdev)
ndr_desc.res = &res;
ndr_desc.numa_node = nid;
- ndr_desc.flush = async_pmem_flush;
+ ndr_desc.flush = virtio_pmem_flush;
set_bit(ND_REGION_PAGEMAP, &ndr_desc.flags);
set_bit(ND_REGION_ASYNC, &ndr_desc.flags);
nd_region = nvdimm_pmem_region_create(vpmem->nvdimm_bus, &ndr_desc);
diff --git a/drivers/nvdimm/virtio_pmem.h b/drivers/nvdimm/virtio_pmem.h
index 0dddefe594c4..4f9ee19aad90 100644
--- a/drivers/nvdimm/virtio_pmem.h
+++ b/drivers/nvdimm/virtio_pmem.h
@@ -51,5 +51,5 @@ struct virtio_pmem {
};
void virtio_pmem_host_ack(struct virtqueue *vq);
-int async_pmem_flush(struct nd_region *nd_region, struct bio *bio);
+int virtio_pmem_flush(struct nd_region *nd_region);
#endif
diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
index b6eddf912568..211c87edb4eb 100644
--- a/include/linux/libnvdimm.h
+++ b/include/linux/libnvdimm.h
@@ -130,7 +130,7 @@ struct nd_region_desc {
int target_node;
unsigned long flags;
struct device_node *of_node;
- int (*flush)(struct nd_region *nd_region, struct bio *bio);
+ int (*flush)(struct nd_region *nd_region);
};
struct device;
@@ -261,7 +261,7 @@ unsigned long nd_blk_memremap_flags(struct nd_blk_region *ndbr);
unsigned int nd_region_acquire_lane(struct nd_region *nd_region);
void nd_region_release_lane(struct nd_region *nd_region, unsigned int lane);
u64 nd_fletcher64(void *addr, size_t len, bool le);
-int nvdimm_flush(struct nd_region *nd_region, struct bio *bio);
+int nvdimm_flush(struct nd_region *nd_region);
int generic_nvdimm_flush(struct nd_region *nd_region);
int nvdimm_has_flush(struct nd_region *nd_region);
int nvdimm_has_cache(struct nd_region *nd_region);
--
2.20.1
1 year, 3 months
[PATCH] MAINTAINERS: Remove Keith from NVDIMM maintainers
by Keith Busch
I no longer work in this capacity for the NVDIMM or DAX subsystems.
Signed-off-by: Keith Busch <kbusch(a)kernel.org>
---
MAINTAINERS | 2 --
1 file changed, 2 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 064333607feb..b6ab2f9d977e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4878,7 +4878,6 @@ F: include/trace/events/fs_dax.h
DEVICE DIRECT ACCESS (DAX)
M: Dan Williams <dan.j.williams(a)intel.com>
M: Vishal Verma <vishal.l.verma(a)intel.com>
-M: Keith Busch <keith.busch(a)intel.com>
M: Dave Jiang <dave.jiang(a)intel.com>
L: linux-nvdimm(a)lists.01.org
S: Supported
@@ -9338,7 +9337,6 @@ LIBNVDIMM: NON-VOLATILE MEMORY DEVICE SUBSYSTEM
M: Dan Williams <dan.j.williams(a)intel.com>
M: Vishal Verma <vishal.l.verma(a)intel.com>
M: Dave Jiang <dave.jiang(a)intel.com>
-M: Keith Busch <keith.busch(a)intel.com>
M: Ira Weiny <ira.weiny(a)intel.com>
L: linux-nvdimm(a)lists.01.org
Q: https://patchwork.kernel.org/project/linux-nvdimm/list/
--
2.21.0
1 year, 3 months
561286 精准的市场/产品定位,让产品首先“好卖”
by 邀请函
来自linux-nvdimm的邮件......
发件人: "邀请函";<kpssc(a)ut.net>
发送时间: 2019-11-22/ 19:00:21
收件人: "linux-nvdimm"<linux-nvdimm(a)lists.01.org>
1 year, 3 months
Новшества в законодательстве о строительстве.
by Myrrh
Глобальные изменения в строительной сфере. Новый подход государства к регулированию и переход на электронный документооборот в системе разрешительных документов, субъектов сертификации и лицензирования
Дата и место проведения: 5 декабря, Киев.
Содержание:
1. Новшества в законодательстве о строительстве. Основные законы и подзаконные акты в отрасли строительства. Порядок их взаимодействия и коллизии:
- Земля. Правовые аспекты наличия документов на землю. Обязательность наличия кадастрового номера земельного участка.
- Градостроительная документация. Отдельные виды градостроительной документации. Пространственное планирование. Генеральный план населенного пункта. План зонирования. Детальный план территории. Проблемные моменты.
2. Служба заказчика. Сертифицированные исполнители. Проектирование. Технический надзор
- Организация и управление строительными проектами в рамках системного подхода и нового законодательства.
- Проектирование – функции Проектировщика и Заказчика.
- Экспертиза в строительстве по новому порядку.
- Авторский надзор.
- Технический надзор.
- Вступление в силу новых ГСН. Новшества и рамки для застройки объектов строительства.
3. Разрешительные органы
- Архитектурно-строительный надзор и контроль. Органы и их полномочия. Государство и органы местной власти. Сфера ответственности и полномочий. Сфера действия и полномочия.
- ГАСК на уровне государственных функций, новые полномочия.
- Инспекции на местах как административные работники от местной власти.
- Распределение штрафных санкций между участниками строительства.
Усиление ответственности в сфере градостроительной деятельности.
Особенности проведения контроля достоверности данных, поданных на регистрацию декларативных и разрешительных документов.
- Разрешительная система в строительстве - новая модель. Классы последствий (СС1, СС2, СС3). Требования к каждому классу.
- Плата в фонд паевого участия и развития инженерно-транспортной и социальной инфраструктуры.
- Что такое объект незавершённого строительства. Анализ возможных путей приобретения объекта незавершённого строительства
4. Важная составная ввода в эксплуатация – технический паспорт. Порядок проведения технической инвентаризации с учетом ввода хранителя инвентарных дел.
- Передача инвентарных дел органам местного самоуправления.
- Контроль за обмером субъектов технической инвентаризации.
- Срок действия технического паспорта.
5. Внедрение системы регистрации имущественных прав на объекты недвижимости. Субъекты регистрации. Риски и защита прав собственности.
- Регистрационные процедуры. Пакет документов, что подаются на регистрацию.
- Особенности регулирования земельных отношений для оформления прав собственности.
- Новые возможности получения информации из реестра.
- Регистрация прав собственности на вновь построенные и реконструированные объекты недвижимого имущества
- Необходимость регистрации права пользования зданием или другим капитальным сооружением
6. Особенности оформления самовольно построенных объектов
- Судебный и внесудебный порядки. Практика и особенности легализации.
- Упрощенный порядок ввода в эксплуатацию самовольно построенных объектов недвижимости.
- Перепланировки.
- Продление строительной амнистии по порядку сдачи в эксплуатацию приказ Минстроя Приказ Минрегиона 03.07.2019 года №158. В чем проблемы и риски собственника самостроя.
Предварительная регистрация > http://stroyuchet.in.ua/training/149/globalnie-izmeneniya-v-stroitelnoy-s...
Если у Вас возникнут дополнительные вопросы - обращайтесь, мы всегда рады Вам помочь!
--
С уважением,
Надежда Семеновна
email-маркетолог
Отказаться от рассылки.
List-Unsubscribe from the newsletter оr complain аbоut SPАМ.
1 year, 3 months
I extremely recommend you to study this e-mail, simply to be sure not a thing could occur
by t-cart@dalmatiner.se
Hello!
I have very bad news for you.
21/07/2019 - on this day I hacked your OS and got full access to your account linux-nvdimm(a)lists.01.org
So, you can change the password, yes... But my malware intercepts it every time.
How I made it:
In the software of the router, through which you went online, was a vulnerability.
I just hacked this router and placed my malicious code on it.
When you went online, my trojan was installed on the OS of your device.
After that, I made a full dump of your disk (I have all your address book, history of viewing sites, all files, phone numbers and addresses of all your contacts).
A month ago, I wanted to lock your device and ask for a not big amount of btc to unlock.
But I looked at the sites that you regularly visit, and I was shocked by what I saw!!!
I'm talk you about sites for adults.
I want to say - you are a BIG pervert. Your fantasy is shifted far away from the normal course!
And I got an idea....
I made a screenshot of the adult sites where you have fun (do you understand what it is about, huh?).
After that, I made a screenshot of your joys (using the camera of your device) and glued them together.
Turned out amazing! You are so spectacular!
I'm know that you would not like to show these screenshots to your friends, relatives or colleagues.
I think $814 is a very, very small amount for my silence.
Besides, I have been spying on you for so long, having spent a lot of time!
Pay ONLY in Bitcoins!
My BTC wallet: 1QKG5uTDq1GU8iNYqycitEL9dv9dctoQsV
You do not know how to use bitcoins?
Enter a query in any search engine: "how to replenish btc wallet".
It's extremely easy
For this payment I give you two days (48 hours).
As soon as this letter is opened, the timer will work.
After payment, my virus and dirty screenshots with your enjoys will be self-destruct automatically.
If I do not receive from you the specified amount, then your device will be locked, and all your contacts will receive a screenshots with your "enjoys".
I hope you understand your situation.
- Do not try to find and destroy my virus! (All your data, files and screenshots is already uploaded to a remote server)
- Do not try to contact me (this is impossible, sender's address was randomly generated)
- Various security services will not help you; formatting a disk or destroying a device will not help, since your data is already on a remote server.
P.S. You are not my single victim. so, I guarantee you that I will not disturb you again after payment!
This is the word of honor hacker
I also ask you to regularly update your antiviruses in the future. This way you will no longer fall into a similar situation.
Do not hold evil! I just do my job.
Have a nice day!
1 year, 3 months
业务主管如何激励团队业绩
by 沈总
转 发......
发件人: "沈总";<agcnl(a)dzaoafsjm.org>
发送时间: 2019-11-20/ 12:01:22
收件人: "linux-nvdimm"<linux-nvdimm(a)lists.01.org>
1 year, 3 months
[RFC PATCH 1/4] libnvdimm/namespace: Make namespace size validation arch dependent
by Aneesh Kumar K.V
The page size used to map the namespace is arch dependent. For example
architectures like ppc64 use 16MB page size for direct-mapping. If the namespace
size is not aligned to the mapping page size, we can observe kernel crash
during namespace init and destroy.
This is due to kernel doing partial map/unmap of the resource range
BUG: Unable to handle kernel data access at 0xc001000406000000
Faulting instruction address: 0xc000000000090790
NIP [c000000000090790] arch_add_memory+0xc0/0x130
LR [c000000000090744] arch_add_memory+0x74/0x130
Call Trace:
arch_add_memory+0x74/0x130 (unreliable)
memremap_pages+0x74c/0xa30
devm_memremap_pages+0x3c/0xa0
pmem_attach_disk+0x188/0x770
nvdimm_bus_probe+0xd8/0x470
really_probe+0x148/0x570
driver_probe_device+0x19c/0x1d0
device_driver_attach+0xcc/0x100
bind_store+0x134/0x1c0
drv_attr_store+0x44/0x60
sysfs_kf_write+0x74/0xc0
kernfs_fop_write+0x1b4/0x290
__vfs_write+0x3c/0x70
vfs_write+0xd0/0x260
ksys_write+0xdc/0x130
system_call+0x5c/0x68
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar(a)linux.ibm.com>
---
arch/arm64/mm/flush.c | 11 +++++++++++
arch/powerpc/lib/pmem.c | 21 +++++++++++++++++++--
arch/x86/mm/pageattr.c | 12 ++++++++++++
include/linux/libnvdimm.h | 1 +
4 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c
index ac485163a4a7..90c54c600023 100644
--- a/arch/arm64/mm/flush.c
+++ b/arch/arm64/mm/flush.c
@@ -91,4 +91,15 @@ void arch_invalidate_pmem(void *addr, size_t size)
__inval_dcache_area(addr, size);
}
EXPORT_SYMBOL_GPL(arch_invalidate_pmem);
+
+unsigned long arch_validate_namespace_size(unsigned int ndr_mappings, unsigned long size)
+{
+ u32 remainder;
+
+ div_u64_rem(size, PAGE_SIZE * ndr_mappings, &remainder);
+ if (remainder)
+ return PAGE_SIZE * ndr_mappings;
+ return 0;
+}
+EXPORT_SYMBOL_GPL(arch_validate_namespace_size);
#endif
diff --git a/arch/powerpc/lib/pmem.c b/arch/powerpc/lib/pmem.c
index 377712e85605..2e661a08dae5 100644
--- a/arch/powerpc/lib/pmem.c
+++ b/arch/powerpc/lib/pmem.c
@@ -17,14 +17,31 @@ void arch_wb_cache_pmem(void *addr, size_t size)
unsigned long start = (unsigned long) addr;
flush_dcache_range(start, start + size);
}
-EXPORT_SYMBOL(arch_wb_cache_pmem);
+EXPORT_SYMBOL_GPL(arch_wb_cache_pmem);
void arch_invalidate_pmem(void *addr, size_t size)
{
unsigned long start = (unsigned long) addr;
flush_dcache_range(start, start + size);
}
-EXPORT_SYMBOL(arch_invalidate_pmem);
+EXPORT_SYMBOL_GPL(arch_invalidate_pmem);
+
+unsigned long arch_validate_namespace_size(unsigned int ndr_mappings, unsigned long size)
+{
+ u32 remainder;
+ unsigned long linear_map_size;
+
+ if (radix_enabled())
+ linear_map_size = PAGE_SIZE;
+ else
+ linear_map_size = (1UL << mmu_psize_defs[mmu_linear_psize].shift);
+
+ div_u64_rem(size, linear_map_size * ndr_mappings, &remainder);
+ if (remainder)
+ return linear_map_size * ndr_mappings;
+ return 0;
+}
+EXPORT_SYMBOL_GPL(arch_validate_namespace_size);
/*
* CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE symbols
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 0d09cc5aad61..023329d7dfac 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -310,6 +310,18 @@ void arch_invalidate_pmem(void *addr, size_t size)
}
EXPORT_SYMBOL_GPL(arch_invalidate_pmem);
+unsigned long arch_validate_namespace_size(unsigned int ndr_mappings, unsigned long size)
+{
+ u32 remainder;
+
+ div_u64_rem(size, PAGE_SIZE * ndr_mappings, &remainder);
+ if (remainder)
+ return PAGE_SIZE * ndr_mappings;
+ return 0;
+}
+EXPORT_SYMBOL_GPL(arch_validate_namespace_size);
+
+
static void __cpa_flush_all(void *arg)
{
unsigned long cache = (unsigned long)arg;
diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
index b6eddf912568..e2f8387d9ef4 100644
--- a/include/linux/libnvdimm.h
+++ b/include/linux/libnvdimm.h
@@ -291,4 +291,5 @@ static inline void arch_invalidate_pmem(void *addr, size_t size)
}
#endif
+unsigned long arch_validate_namespace_size(unsigned int ndr_mappings, unsigned long size);
#endif /* __LIBNVDIMM_H__ */
--
2.21.0
1 year, 3 months