NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/57772: DRMKMS [FIXES]



The following reply was made to PR kern/57772; it has been noted by GNATS.

From: tlaronde%kergis.com@localhost
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/57772: DRMKMS [FIXES]
Date: Sat, 16 Dec 2023 08:47:16 +0100

 I got it wrong: on some arches (for example x68k) the kernel pages can
 not be put anywhere in ram but only on low addresses thus limiting
 de facto the amount of memory available for kernel.
 
 But such limits can exist for dma mapping too (and differently).
 
 So correct the comment. The fix avoids publishing crazy numbers, and
 since this is not allocation but fixing an upper limit on what _could_
 be allocated, this can do for now.
 
 But this is too simplistic. This is MD and should be handled with more
 care.
 
 diff --git a/sys/external/bsd/drm2/include/linux/mm.h b/sys/external/bsd/drm2/include/linux/mm.h
 index e467f0ede6e2..79a958d10852 100644
 --- a/sys/external/bsd/drm2/include/linux/mm.h
 +++ b/sys/external/bsd/drm2/include/linux/mm.h
 @@ -54,15 +54,29 @@ struct file;
  #define	untagged_addr(x)	(x)
  
  /*
 - * All values (except mem_unit of course) are pages. Only used or
 - * making some sense on NetBSD members are filled: *high do not make
 - * sense (these are even not always enabled in Linux). totalhigh is
 - * set to 0 to neutralize the use, even in conditional HIGHMEM blocks.
 + * All values (except mem_unit of course) are pages. Only NetBSD
 + * used members or members appearing in the code (but not used here)
 + * are declared.
 + */
 +
 +/* XXX
 + *
 + * High mem have some meaning in some arches where the kernel
 + * pages can not be put anywhere in ram but have to appear in a
 + * limited range (low range).
 + * But on some arches, dma can not be map anywhere either.
 + * These are two different things, to be set M.D.
 + * For the moment, we make it simple: let's assume that the whole ram
 + * can be used for kernel and dma. This is used only to define what
 + * _could_ be used. Real * allocation is another subject.
 + *
 + * For the moment, totalhigh is set to 0 in order to neutralize the use, 
 + * even in conditional HIGHMEM blocks.
   */
  struct sysinfo {
  	unsigned long totalram;
  	unsigned long freeram;
 -	unsigned long totalhigh;	/* does not make sense here */
 +	unsigned long totalhigh;	/* XXX arch dependent */
  	uint32_t mem_unit;
  };
  
 -- 
         Thierry Laronde <tlaronde +AT+ kergis +dot+ com>
                      http://www.kergis.com/
                     http://kertex.kergis.com/
 Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C
 



Home | Main Index | Thread Index | Old Index