Displaying 20 results from an estimated 23 matches for "subblock_size".
2020 Jun 08
2
[PATCH] virtio_mem: prevent overflow with subblock size
...> > can overflow. Rather than try to catch all instances of that,
> > let's tweak block size to 64 bit.
>
> I fail to see where we could actually trigger an overflow. The reported
> warning looked like a false positive to me.
So
const uint64_t size = count * vm->subblock_size;
is it unreasonable for count to be 4K with subblock_size being 1M?
> >
> > It ripples through UAPI which is an ABI change, but it's not too late to
> > make it, and it will allow supporting >4Gbyte blocks while might
> > become necessary down the road.
> >...
2020 Jun 08
2
[PATCH] virtio_mem: prevent overflow with subblock size
...> > can overflow. Rather than try to catch all instances of that,
> > let's tweak block size to 64 bit.
>
> I fail to see where we could actually trigger an overflow. The reported
> warning looked like a false positive to me.
So
const uint64_t size = count * vm->subblock_size;
is it unreasonable for count to be 4K with subblock_size being 1M?
> >
> > It ripples through UAPI which is an ABI change, but it's not too late to
> > make it, and it will allow supporting >4Gbyte blocks while might
> > become necessary down the road.
> >...
2020 Jun 08
4
[PATCH] virtio_mem: prevent overflow with subblock size
...). */
- uint32_t device_block_size;
+ uint64_t device_block_size;
/* The translated node id. NUMA_NO_NODE in case not specified. */
int nid;
/* Physical start address of the memory region. */
@@ -86,7 +86,7 @@ struct virtio_mem {
uint64_t region_size;
/* The subblock size. */
- uint32_t subblock_size;
+ uint64_t subblock_size;
/* The number of subblocks per memory block. */
uint32_t nb_sb_per_mb;
@@ -1698,9 +1698,9 @@ static int virtio_mem_init(struct virtio_mem *vm)
* - At least the device block size.
* In the worst case, a single subblock per memory block.
*/
- vm->subblock_...
2020 Jun 08
4
[PATCH] virtio_mem: prevent overflow with subblock size
...). */
- uint32_t device_block_size;
+ uint64_t device_block_size;
/* The translated node id. NUMA_NO_NODE in case not specified. */
int nid;
/* Physical start address of the memory region. */
@@ -86,7 +86,7 @@ struct virtio_mem {
uint64_t region_size;
/* The subblock size. */
- uint32_t subblock_size;
+ uint64_t subblock_size;
/* The number of subblocks per memory block. */
uint32_t nb_sb_per_mb;
@@ -1698,9 +1698,9 @@ static int virtio_mem_init(struct virtio_mem *vm)
* - At least the device block size.
* In the worst case, a single subblock per memory block.
*/
- vm->subblock_...
2020 Jun 08
0
[PATCH] virtio_mem: prevent overflow with subblock size
...nt64_t device_block_size;
> /* The translated node id. NUMA_NO_NODE in case not specified. */
> int nid;
> /* Physical start address of the memory region. */
> @@ -86,7 +86,7 @@ struct virtio_mem {
> uint64_t region_size;
>
> /* The subblock size. */
> - uint32_t subblock_size;
> + uint64_t subblock_size;
> /* The number of subblocks per memory block. */
> uint32_t nb_sb_per_mb;
>
> @@ -1698,9 +1698,9 @@ static int virtio_mem_init(struct virtio_mem *vm)
> * - At least the device block size.
> * In the worst case, a single subblock per mem...
2020 Mar 10
2
[PATCH v1 07/11] virtio-mem: Allow to offline partially unplugged memory blocks
On Mon 02-03-20 14:49:37, David Hildenbrand wrote:
[...]
> +static void virtio_mem_notify_going_offline(struct virtio_mem *vm,
> + unsigned long mb_id)
> +{
> + const unsigned long nr_pages = PFN_DOWN(vm->subblock_size);
> + unsigned long pfn;
> + int sb_id, i;
> +
> + for (sb_id = 0; sb_id < vm->nb_sb_per_mb; sb_id++) {
> + if (virtio_mem_mb_test_sb_plugged(vm, mb_id, sb_id, 1))
> + continue;
> + /*
> + * Drop our reference to the pages so the memory can get
> + * offline...
2020 Mar 10
2
[PATCH v1 07/11] virtio-mem: Allow to offline partially unplugged memory blocks
On Mon 02-03-20 14:49:37, David Hildenbrand wrote:
[...]
> +static void virtio_mem_notify_going_offline(struct virtio_mem *vm,
> + unsigned long mb_id)
> +{
> + const unsigned long nr_pages = PFN_DOWN(vm->subblock_size);
> + unsigned long pfn;
> + int sb_id, i;
> +
> + for (sb_id = 0; sb_id < vm->nb_sb_per_mb; sb_id++) {
> + if (virtio_mem_mb_test_sb_plugged(vm, mb_id, sb_id, 1))
> + continue;
> + /*
> + * Drop our reference to the pages so the memory can get
> + * offline...
2020 Jun 08
0
[PATCH] virtio_mem: prevent overflow with subblock size
...y to catch all instances of that,
>>> let's tweak block size to 64 bit.
>>
>> I fail to see where we could actually trigger an overflow. The reported
>> warning looked like a false positive to me.
>
>
> So
>
> const uint64_t size = count * vm->subblock_size;
>
> is it unreasonable for count to be 4K with subblock_size being 1M?
virtio_mem_mb_plug_sb() and friends are only called on subblocks
residing within a single Linux memory block. (currently, 128MB .. 2G on
x86-64). A subblock on x86-64 is currently at least 4MB.
So "count * vm->...
2020 Jun 09
1
[PATCH] virtio_mem: fix printk format
...+1717,8 @@ static int virtio_mem_init(struct virtio_mem *vm)
(unsigned long long)vm->device_block_size);
dev_info(&vm->vdev->dev, "memory block size: 0x%lx",
memory_block_size_bytes());
- dev_info(&vm->vdev->dev, "subblock size: 0x%x",
- vm->subblock_size);
+ dev_info(&vm->vdev->dev, "subblock size: 0x%llx",
+ (unsigned long long)vm->subblock_size);
if (vm->nid != NUMA_NO_NODE)
dev_info(&vm->vdev->dev, "nid: %d", vm->nid);
--
MST
2020 Mar 10
1
[PATCH v1 07/11] virtio-mem: Allow to offline partially unplugged memory blocks
...al Hocko wrote:
> > On Mon 02-03-20 14:49:37, David Hildenbrand wrote:
> > [...]
> >> +static void virtio_mem_notify_going_offline(struct virtio_mem *vm,
> >> + unsigned long mb_id)
> >> +{
> >> + const unsigned long nr_pages = PFN_DOWN(vm->subblock_size);
> >> + unsigned long pfn;
> >> + int sb_id, i;
> >> +
> >> + for (sb_id = 0; sb_id < vm->nb_sb_per_mb; sb_id++) {
> >> + if (virtio_mem_mb_test_sb_plugged(vm, mb_id, sb_id, 1))
> >> + continue;
> >> + /*
> >> + *...
2020 Mar 02
0
[PATCH v1 07/11] virtio-mem: Allow to offline partially unplugged memory blocks
...tio/virtio_mem.c
@@ -570,6 +570,53 @@ static void virtio_mem_notify_online(struct virtio_mem *vm, unsigned long mb_id,
virtio_mem_retry(vm);
}
+static void virtio_mem_notify_going_offline(struct virtio_mem *vm,
+ unsigned long mb_id)
+{
+ const unsigned long nr_pages = PFN_DOWN(vm->subblock_size);
+ unsigned long pfn;
+ int sb_id, i;
+
+ for (sb_id = 0; sb_id < vm->nb_sb_per_mb; sb_id++) {
+ if (virtio_mem_mb_test_sb_plugged(vm, mb_id, sb_id, 1))
+ continue;
+ /*
+ * Drop our reference to the pages so the memory can get
+ * offlined and add the unplugged pages to the managed...
2020 Mar 02
0
[PATCH v1 02/11] virtio-mem: Paravirtualized memory hotplug
...ested_size;
+
+ /* The device block size (for communicating with the device). */
+ uint32_t device_block_size;
+ /* The translated node id. NUMA_NO_NODE in case not specified. */
+ int nid;
+ /* Physical start address of the memory region. */
+ uint64_t addr;
+
+ /* The subblock size. */
+ uint32_t subblock_size;
+ /* The number of subblocks per memory block. */
+ uint32_t nb_sb_per_mb;
+
+ /* Id of the first memory block of this device. */
+ unsigned long first_mb_id;
+ /* Id of the last memory block of this device. */
+ unsigned long last_mb_id;
+ /* Id of the last usable memory block of this device. */...
2020 May 07
17
[PATCH v4 00/15] virtio-mem: paravirtualized memory
This series is based on v5.7-rc4. The patches are located at:
https://github.com/davidhildenbrand/linux.git virtio-mem-v4
This is basically a resend of v3 [1], now based on v5.7-rc4 and restested.
One patch was reshuffled and two ACKs I missed to add were added. The
rebase did not require any modifications to patches.
Details about virtio-mem can be found in the cover letter of v2 [2]. A
2020 Mar 10
0
[PATCH v1 07/11] virtio-mem: Allow to offline partially unplugged memory blocks
On 10.03.20 12:43, Michal Hocko wrote:
> On Mon 02-03-20 14:49:37, David Hildenbrand wrote:
> [...]
>> +static void virtio_mem_notify_going_offline(struct virtio_mem *vm,
>> + unsigned long mb_id)
>> +{
>> + const unsigned long nr_pages = PFN_DOWN(vm->subblock_size);
>> + unsigned long pfn;
>> + int sb_id, i;
>> +
>> + for (sb_id = 0; sb_id < vm->nb_sb_per_mb; sb_id++) {
>> + if (virtio_mem_mb_test_sb_plugged(vm, mb_id, sb_id, 1))
>> + continue;
>> + /*
>> + * Drop our reference to the pages so the m...
2020 Jun 08
0
[vhost:vhost 18/52] drivers/virtio/virtio_mem.c:1391:5: warning: Variable 'rc' is reassigned a value before the old one has been used.
...used.
rc = virtio_mem_init_vq(vm);
^
>> drivers/virtio/virtio_mem.c:801:22: warning: int result is assigned to long variable. If the variable is long to avoid loss of information, then you have loss of information. [truncLongCastAssignment]
const uint64_t size = count * vm->subblock_size;
^
drivers/virtio/virtio_mem.c:822:22: warning: int result is assigned to long variable. If the variable is long to avoid loss of information, then you have loss of information. [truncLongCastAssignment]
const uint64_t size = count * vm->subblock_size;...
2020 May 07
20
[PATCH v3 00/15] virtio-mem: paravirtualized memory
This series is based on latest linux-next. The patches are located at:
https://github.com/davidhildenbrand/linux.git virtio-mem-v3
Patch #1 - #10 where contained in v2 and only contain minor modifications
(mostly smaller fixes). The remaining patches are new and contain smaller
optimizations.
Details about virtio-mem can be found in the cover letter of v2 [1]. A
basic QEMU implementation was
2020 May 07
20
[PATCH v3 00/15] virtio-mem: paravirtualized memory
This series is based on latest linux-next. The patches are located at:
https://github.com/davidhildenbrand/linux.git virtio-mem-v3
Patch #1 - #10 where contained in v2 and only contain minor modifications
(mostly smaller fixes). The remaining patches are new and contain smaller
optimizations.
Details about virtio-mem can be found in the cover letter of v2 [1]. A
basic QEMU implementation was
2019 Dec 12
19
[PATCH RFC v4 00/13] virtio-mem: paravirtualized memory
This series is based on latest linux-next. The patches are located at:
https://github.com/davidhildenbrand/linux.git virtio-mem-rfc-v4
The basic idea of virtio-mem is to provide a flexible,
cross-architecture memory hot(un)plug solution that avoids many limitations
imposed by existing technologies, architectures, and interfaces. More
details can be found below and in linked material.
This
2019 Dec 12
19
[PATCH RFC v4 00/13] virtio-mem: paravirtualized memory
This series is based on latest linux-next. The patches are located at:
https://github.com/davidhildenbrand/linux.git virtio-mem-rfc-v4
The basic idea of virtio-mem is to provide a flexible,
cross-architecture memory hot(un)plug solution that avoids many limitations
imposed by existing technologies, architectures, and interfaces. More
details can be found below and in linked material.
This
2020 Mar 11
12
[PATCH v2 00/10] virtio-mem: paravirtualized memory
This series is based on latest linux-next. The patches are located at:
https://github.com/davidhildenbrand/linux.git virtio-mem-v2
I now have acks for all !virtio-mem changes. I'll be happy to get review
feedback, testing reports, etc. for the virtio-mem changes. If there are
no further comments, I guess this is good to go as a v1 soon.
The basic idea of virtio-mem is to provide a