Dan Williams
2019-Jun-17 17:37 UTC
[Nouveau] [PATCH 06/25] mm: factor out a devm_request_free_mem_region helper
On Mon, Jun 17, 2019 at 5:27 AM Christoph Hellwig <hch at lst.de> wrote:> > Keep the physical address allocation that hmm_add_device does with the > rest of the resource code, and allow future reuse of it without the hmm > wrapper. > > Signed-off-by: Christoph Hellwig <hch at lst.de> > Reviewed-by: Jason Gunthorpe <jgg at mellanox.com> > Reviewed-by: John Hubbard <jhubbard at nvidia.com> > --- > include/linux/ioport.h | 2 ++ > kernel/resource.c | 39 +++++++++++++++++++++++++++++++++++++++ > mm/hmm.c | 33 ++++----------------------------- > 3 files changed, 45 insertions(+), 29 deletions(-) > > diff --git a/include/linux/ioport.h b/include/linux/ioport.h > index da0ebaec25f0..76a33ae3bf6c 100644 > --- a/include/linux/ioport.h > +++ b/include/linux/ioport.h > @@ -286,6 +286,8 @@ static inline bool resource_overlaps(struct resource *r1, struct resource *r2) > return (r1->start <= r2->end && r1->end >= r2->start); > } > > +struct resource *devm_request_free_mem_region(struct device *dev, > + struct resource *base, unsigned long size);This appears to need a 'static inline' helper stub in the CONFIG_DEVICE_PRIVATE=n case, otherwise this compile error triggers: ld: mm/hmm.o: in function `hmm_devmem_add': /home/dwillia2/git/linux/mm/hmm.c:1427: undefined reference to `devm_request_free_mem_region'
Christoph Hellwig
2019-Jun-17 17:40 UTC
[Nouveau] [PATCH 06/25] mm: factor out a devm_request_free_mem_region helper
On Mon, Jun 17, 2019 at 10:37:12AM -0700, Dan Williams wrote:> > +struct resource *devm_request_free_mem_region(struct device *dev, > > + struct resource *base, unsigned long size); > > This appears to need a 'static inline' helper stub in the > CONFIG_DEVICE_PRIVATE=n case, otherwise this compile error triggers: > > ld: mm/hmm.o: in function `hmm_devmem_add': > /home/dwillia2/git/linux/mm/hmm.c:1427: undefined reference to > `devm_request_free_mem_region'*sigh* - hmm_devmem_add already only works for device private memory, so it shouldn't be built if that option is not enabled, but in the current code it is. And a few patches later in the series we just kill it off entirely, and the only real caller of this function already depends on CONFIG_DEVICE_PRIVATE. So I'm tempted to just ignore the strict bisectability requirement here instead of making things messy by either adding the proper ifdefs in hmm.c or providing a stub we don't really need.
Christoph Hellwig
2019-Jun-17 17:42 UTC
[Nouveau] [PATCH 06/25] mm: factor out a devm_request_free_mem_region helper
On Mon, Jun 17, 2019 at 07:40:18PM +0200, Christoph Hellwig wrote:> On Mon, Jun 17, 2019 at 10:37:12AM -0700, Dan Williams wrote: > > > +struct resource *devm_request_free_mem_region(struct device *dev, > > > + struct resource *base, unsigned long size); > > > > This appears to need a 'static inline' helper stub in the > > CONFIG_DEVICE_PRIVATE=n case, otherwise this compile error triggers: > > > > ld: mm/hmm.o: in function `hmm_devmem_add': > > /home/dwillia2/git/linux/mm/hmm.c:1427: undefined reference to > > `devm_request_free_mem_region' > > *sigh* - hmm_devmem_add already only works for device private memory, > so it shouldn't be built if that option is not enabled, but in the > current code it is. And a few patches later in the series we just > kill it off entirely, and the only real caller of this function > already depends on CONFIG_DEVICE_PRIVATE. So I'm tempted to just > ignore the strict bisectability requirement here instead of making > things messy by either adding the proper ifdefs in hmm.c or providing > a stub we don't really need.Actually, I could just move the patch to mark CONFIG_DEVICE_PUBLIC broken earlier, which would force hmm_devmem_add to only be built when CONFIG_DEVICE_PRIVATE ist set.
Reasonably Related Threads
- [PATCH 06/25] mm: factor out a devm_request_free_mem_region helper
- [PATCH 06/25] mm: factor out a devm_request_free_mem_region helper
- [PATCH 06/22] mm: factor out a devm_request_free_mem_region helper
- [PATCH 06/22] mm: factor out a devm_request_free_mem_region helper
- [PATCH 06/22] mm: factor out a devm_request_free_mem_region helper