* [PATCH] daxctl: Fix memblock enumeration off-by-one
@ 2023-02-02 20:56 Dan Williams
2023-02-03 0:03 ` Eliot Moss
2023-02-03 23:07 ` Verma, Vishal L
0 siblings, 2 replies; 5+ messages in thread
From: Dan Williams @ 2023-02-02 20:56 UTC (permalink / raw)
To: vishal.l.verma; +Cc: nvdimm, linux-cxl
A memblock is an inclusive memory range. Bound the search by the last
address in the memory block.
Found by wondering why an offline 32-block (at 128MB == 4GB) range was
reported as 33 blocks with one online.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
daxctl/lib/libdaxctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/daxctl/lib/libdaxctl.c b/daxctl/lib/libdaxctl.c
index 5703992f5b88..d990479d8585 100644
--- a/daxctl/lib/libdaxctl.c
+++ b/daxctl/lib/libdaxctl.c
@@ -1477,7 +1477,7 @@ static int memblock_in_dev(struct daxctl_memory *mem, const char *memblock)
err(ctx, "%s: Unable to determine resource\n", devname);
return -EACCES;
}
- dev_end = dev_start + daxctl_dev_get_size(dev);
+ dev_end = dev_start + daxctl_dev_get_size(dev) - 1;
memblock_size = daxctl_memory_get_block_size(mem);
if (!memblock_size) {
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] daxctl: Fix memblock enumeration off-by-one
2023-02-02 20:56 [PATCH] daxctl: Fix memblock enumeration off-by-one Dan Williams
@ 2023-02-03 0:03 ` Eliot Moss
2023-02-03 0:11 ` Dan Williams
2023-02-03 23:07 ` Verma, Vishal L
1 sibling, 1 reply; 5+ messages in thread
From: Eliot Moss @ 2023-02-03 0:03 UTC (permalink / raw)
To: Dan Williams, vishal.l.verma; +Cc: nvdimm, linux-cxl
On 2/3/2023 7:56 AM, Dan Williams wrote:
> A memblock is an inclusive memory range. Bound the search by the last
> address in the memory block.
>
> Found by wondering why an offline 32-block (at 128MB == 4GB) range was
> reported as 33 blocks with one online.
>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> daxctl/lib/libdaxctl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/daxctl/lib/libdaxctl.c b/daxctl/lib/libdaxctl.c
> index 5703992f5b88..d990479d8585 100644
> --- a/daxctl/lib/libdaxctl.c
> +++ b/daxctl/lib/libdaxctl.c
> @@ -1477,7 +1477,7 @@ static int memblock_in_dev(struct daxctl_memory *mem, const char *memblock)
> err(ctx, "%s: Unable to determine resource\n", devname);
> return -EACCES;
> }
> - dev_end = dev_start + daxctl_dev_get_size(dev);
> + dev_end = dev_start + daxctl_dev_get_size(dev) - 1;
>
> memblock_size = daxctl_memory_get_block_size(mem);
> if (!memblock_size) {
Might this address the bug I reported?
Regards - Eliot Moss
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] daxctl: Fix memblock enumeration off-by-one
2023-02-03 0:03 ` Eliot Moss
@ 2023-02-03 0:11 ` Dan Williams
2023-02-03 0:59 ` Eliot Moss
0 siblings, 1 reply; 5+ messages in thread
From: Dan Williams @ 2023-02-03 0:11 UTC (permalink / raw)
To: Eliot Moss, Dan Williams, vishal.l.verma; +Cc: nvdimm, linux-cxl
Eliot Moss wrote:
> On 2/3/2023 7:56 AM, Dan Williams wrote:
> > A memblock is an inclusive memory range. Bound the search by the last
> > address in the memory block.
> >
> > Found by wondering why an offline 32-block (at 128MB == 4GB) range was
> > reported as 33 blocks with one online.
> >
> > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> > ---
> > daxctl/lib/libdaxctl.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/daxctl/lib/libdaxctl.c b/daxctl/lib/libdaxctl.c
> > index 5703992f5b88..d990479d8585 100644
> > --- a/daxctl/lib/libdaxctl.c
> > +++ b/daxctl/lib/libdaxctl.c
> > @@ -1477,7 +1477,7 @@ static int memblock_in_dev(struct daxctl_memory *mem, const char *memblock)
> > err(ctx, "%s: Unable to determine resource\n", devname);
> > return -EACCES;
> > }
> > - dev_end = dev_start + daxctl_dev_get_size(dev);
> > + dev_end = dev_start + daxctl_dev_get_size(dev) - 1;
> >
> > memblock_size = daxctl_memory_get_block_size(mem);
> > if (!memblock_size) {
>
> Might this address the bug I reported?
This one?
http://lore.kernel.org/r/558d0ff1-4658-a11b-5a6d-0be0a3a6799c@cs.umass.edu
I don't think so, that one seems to have something to do with the file
extent layout that causes fs/dax.c to fallback to 4K mappings.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] daxctl: Fix memblock enumeration off-by-one
2023-02-03 0:11 ` Dan Williams
@ 2023-02-03 0:59 ` Eliot Moss
0 siblings, 0 replies; 5+ messages in thread
From: Eliot Moss @ 2023-02-03 0:59 UTC (permalink / raw)
To: Dan Williams, vishal.l.verma; +Cc: nvdimm, linux-cxl
On 2/3/2023 11:11 AM, Dan Williams wrote:
> Eliot Moss wrote:
>> On 2/3/2023 7:56 AM, Dan Williams wrote:
>>> A memblock is an inclusive memory range. Bound the search by the last
>>> address in the memory block.
>>>
>>> Found by wondering why an offline 32-block (at 128MB == 4GB) range was
>>> reported as 33 blocks with one online.
>>>
>>> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
>>> ---
>>> daxctl/lib/libdaxctl.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/daxctl/lib/libdaxctl.c b/daxctl/lib/libdaxctl.c
>>> index 5703992f5b88..d990479d8585 100644
>>> --- a/daxctl/lib/libdaxctl.c
>>> +++ b/daxctl/lib/libdaxctl.c
>>> @@ -1477,7 +1477,7 @@ static int memblock_in_dev(struct daxctl_memory *mem, const char *memblock)
>>> err(ctx, "%s: Unable to determine resource\n", devname);
>>> return -EACCES;
>>> }
>>> - dev_end = dev_start + daxctl_dev_get_size(dev);
>>> + dev_end = dev_start + daxctl_dev_get_size(dev) - 1;
>>>
>>> memblock_size = daxctl_memory_get_block_size(mem);
>>> if (!memblock_size) {
>>
>> Might this address the bug I reported?
>
> This one?
>
> http://lore.kernel.org/r/558d0ff1-4658-a11b-5a6d-0be0a3a6799c@cs.umass.edu
>
> I don't think so, that one seems to have something to do with the file
> extent layout that causes fs/dax.c to fallback to 4K mappings.
That was the one - I think you're right; it's not immediately related.
EM
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] daxctl: Fix memblock enumeration off-by-one
2023-02-02 20:56 [PATCH] daxctl: Fix memblock enumeration off-by-one Dan Williams
2023-02-03 0:03 ` Eliot Moss
@ 2023-02-03 23:07 ` Verma, Vishal L
1 sibling, 0 replies; 5+ messages in thread
From: Verma, Vishal L @ 2023-02-03 23:07 UTC (permalink / raw)
To: Williams, Dan J; +Cc: linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev
On Thu, 2023-02-02 at 12:56 -0800, Dan Williams wrote:
> A memblock is an inclusive memory range. Bound the search by the last
> address in the memory block.
>
> Found by wondering why an offline 32-block (at 128MB == 4GB) range was
> reported as 33 blocks with one online.
>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> daxctl/lib/libdaxctl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Good find! Applied, thanks.
>
> diff --git a/daxctl/lib/libdaxctl.c b/daxctl/lib/libdaxctl.c
> index 5703992f5b88..d990479d8585 100644
> --- a/daxctl/lib/libdaxctl.c
> +++ b/daxctl/lib/libdaxctl.c
> @@ -1477,7 +1477,7 @@ static int memblock_in_dev(struct daxctl_memory *mem, const char *memblock)
> err(ctx, "%s: Unable to determine resource\n", devname);
> return -EACCES;
> }
> - dev_end = dev_start + daxctl_dev_get_size(dev);
> + dev_end = dev_start + daxctl_dev_get_size(dev) - 1;
>
> memblock_size = daxctl_memory_get_block_size(mem);
> if (!memblock_size) {
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-02-03 23:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-02 20:56 [PATCH] daxctl: Fix memblock enumeration off-by-one Dan Williams
2023-02-03 0:03 ` Eliot Moss
2023-02-03 0:11 ` Dan Williams
2023-02-03 0:59 ` Eliot Moss
2023-02-03 23:07 ` Verma, Vishal L
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox