From: Tristan Gingold Subject: Re: [XenPPC] RFC: xencomm - linux side Date: Fri, 25 Aug 2006 09:02:08 +0200 Message-ID: <200608250902.08353.Tristan.Gingold@bull.net> References: <200608211718.50751.Tristan.Gingold@bull.net> <200608240951.07113.Tristan.Gingold@bull.net> <1156434194.24494.15.camel@basalt.austin.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <1156434194.24494.15.camel@basalt.austin.ibm.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Hollis Blanchard Cc: xen-ia64-devel , xen-devel , xen-ppc-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Le Jeudi 24 Ao=C3=BBt 2006 17:43, Hollis Blanchard a =C3=A9crit : > On Thu, 2006-08-24 at 09:51 +0200, Tristan Gingold wrote: > > > My suggestion: have xencomm_create() test IS_KERNEL_ADDR() (in whatev= er > > > way is best for portability) and if it is, do the "inline" stuff. On > > > the free side, if the descriptor was inline, free can just return. Th= at > > > would also make me happy because it removes the need to think about > > > whether callers can/should call "create_inline" or not; the code just > > > does the right thing. > > > > We definitly disagree here. One whole point of xencomm_create_inline is > > it doesn't allocate memory and can't fail. Because of that we don't ne= ed > > to worry about failure and freeing memory. This makes the code a lot > > easier to write and to read. > > It would simplify the code even more to fold xencomm_create_inline() > into xencomm_create(), as I suggest above. That way, the developer never > needs to consider if the particular hypercall could ever be called > before the page allocator works. Proving that assumption for some > hypercall, and guaranteeing it will remain true in the future no matter > what Linux changes occur, is a lot more difficult than remembering to > call free() after create(). Could you modify the ppc code, I will be happy to fetch directly the code f= or=20 this new idea. > The goal of any API should be to make it impossible to use it > incorrectly, and I think my (firm) suggestion makes that true here. What about possible errors ? Tristan.