linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Oded Gabbay <oded.gabbay@gmail.com>
Cc: "Linux-Kernel@Vger. Kernel. Org" <linux-kernel@vger.kernel.org>,
	Mike Rapoport <rppt@linux.ibm.com>,
	Olof Johansson <olof@lixom.net>,
	ogabbay@habana.ai, Arnd Bergmann <arnd@arndb.de>,
	Joe Perches <joe@perches.com>
Subject: Re: [PATCH v4 00/15] Habana Labs kernel driver
Date: Thu, 14 Feb 2019 11:37:20 +0100	[thread overview]
Message-ID: <20190214103720.GA6518@kroah.com> (raw)
In-Reply-To: <CAFCwf13-qVm_2UV5294jwwud4+oCZB_2WQfNmbg2qAUBCj4d4g@mail.gmail.com>

On Thu, Feb 14, 2019 at 12:15:19PM +0200, Oded Gabbay wrote:
> On Thu, Feb 14, 2019 at 12:07 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Thu, Feb 14, 2019 at 11:58:41AM +0200, Oded Gabbay wrote:
> > > On Thu, Feb 14, 2019 at 9:13 AM Oded Gabbay <oded.gabbay@gmail.com> wrote:
> > > >
> > > > On Thu, Feb 14, 2019 at 9:11 AM Greg KH <gregkh@linuxfoundation.org> wrote:
> > > > >
> > > > > On Mon, Feb 11, 2019 at 05:17:36PM +0200, Oded Gabbay wrote:
> > > > > > Hello,
> > > > > > This is v4 of the Habana Labs kernel driver patch-set. It contains fixes
> > > > > > according to reviews done on v3, mainly for the command buffer, sysfs and MMU
> > > > > > patches. In addition, patch 2/15 was reduced in size from 4.3MB to 1.4MB.
> > > > > >
> > > > > > The patch-set is rebased on v5.0-rc6.
> > > > > >
> > > > > > Link to v3 cover letter: https://lkml.org/lkml/2019/2/4/1033
> > > > > >
> > > > > > Link to v2 cover letter: https://lkml.org/lkml/2019/1/30/1003
> > > > > >
> > > > > > Link to v1 cover letter: https://lwn.net/Articles/777342/
> > > > > >
> > > > > > I would appricate any feedback, question and/or review.
> > > > >
> > > > > There's been some 0-day bot feedback on some of these patches now that I
> > > > > put them in my -testing branch.  So I'm going to drop the patch series
> > > > > from there now and wait for a v5 of the series that hopefully will have
> > > > > those issues fixed :)
> > > > >
> > > Hi Greg,
> > > I looked at the 4 warnings I received from your emails, and they all
> > > appear in i386 architecture.
> > > I don't want to support 32-bit kernel and I don't intend to support it.
> > > Can we just specify in kconfig that we don't support it, and then you
> > > won't get these warnings ?
> >
> > No, if you use the correct kernel types and castings, you should be
> > fine.
> >
> > > I initially set in kconfig to support only x86_64, and you told me
> > > (and you were right) not to limit to that. But I do think I would like
> > > to disable the driver on i386.
> >
> > You might want to not support it on 32bit kernels, but even then, I
> > think all you need to do here is use the proper kernel types and you
> > will be ok.
> >
> > As an example:
> >    drivers/misc/habanalabs/goya/goya.c: In function 'goya_early_init':
> >    drivers/misc/habanalabs/goya/goya.c:404:4: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 4 has type 'resource_size_t' {aka 'unsigned int'} [-Wformat=]
> >        "Not " HL_NAME "? BAR %d size %llu, expecting %llu\n",
> >        ^~~~~~
> >
> > Use the correct printk type for a resource_size_t.
> >
> > You got that warning twice.
> >
> > Another one is:
> > >> drivers/misc/habanalabs/device.c:283:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> >      volatile u32 *paddr = (volatile u32 *) addr;
> >
> > Now using a volatile makes me want to say "you are doing it wrong!", as
> > yes, you shouldn't be reading directly from a memory pointer, you need
> > to use the correct iomem accessors, right?
> >
> > So I think just fixing this stuff up should be simple, the
> > resource_size_t fix is needed no matter what size kernel you run on.
> >
> > thanks,
> >
> > greg k-h
> 
> ok, got it, will be fixed.
> 
> Regarding the volatile, this is not an I/O memory. This is host memory
> that is changed by the device. That's why I wrote in the comment
> there:
> /*
> * paddr is defined as volatile because it points to HOST memory,
> * which is being written to by the device. Therefore, we can't use
> * locks to synchronize it and it is not a memory-mapped register space

What do you mean by "HOST" memory?  The memory that the processor is
running on?

> */
> 
> Am I missing something here ? I don't think I should use the iomem
> accessors on host memory, right ? Assuming I'm right, is there another
> way to ensure the compiler won't optimize this without using the
> volatile keyword ?

What are you trying to prevent from being "optimized" here?

Are you sure you just don't need a correct memory barrier?  That's the
only way to ensure that if you write to a location from one thread/cpu,
it will show up to the other thread/cpu correctly.  volatile will not
ensure that for you at all (hint, the compiler just ignores it for the
most part.)

thanks,

greg k-h

  reply	other threads:[~2019-02-14 10:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-11 15:17 [PATCH v4 00/15] Habana Labs kernel driver Oded Gabbay
2019-02-11 15:17 ` [PATCH v4 01/15] habanalabs: add skeleton driver Oded Gabbay
2019-02-11 15:17 ` [PATCH v4 03/15] habanalabs: add basic Goya support Oded Gabbay
2019-02-11 15:17 ` [PATCH v4 04/15] habanalabs: add context and ASID modules Oded Gabbay
2019-02-11 15:17 ` [PATCH v4 05/15] habanalabs: add command buffer module Oded Gabbay
2019-02-11 15:17 ` [PATCH v4 06/15] habanalabs: add basic Goya h/w initialization Oded Gabbay
2019-02-11 15:17 ` [PATCH v4 07/15] habanalabs: add h/w queues module Oded Gabbay
2019-02-11 15:17 ` [PATCH v4 08/15] habanalabs: add event queue and interrupts Oded Gabbay
2019-02-11 15:17 ` [PATCH v4 09/15] habanalabs: add sysfs and hwmon support Oded Gabbay
2019-02-11 15:17 ` [PATCH v4 10/15] habanalabs: add device reset support Oded Gabbay
2019-02-11 15:17 ` [PATCH v4 11/15] habanalabs: add command submission module Oded Gabbay
2019-02-11 15:17 ` [PATCH v4 12/15] habanalabs: add virtual memory and MMU modules Oded Gabbay
2019-02-11 17:03   ` Mike Rapoport
2019-02-11 15:17 ` [PATCH v4 13/15] habanalabs: implement INFO IOCTL Oded Gabbay
2019-02-11 15:17 ` [PATCH v4 14/15] habanalabs: add debugfs support Oded Gabbay
2019-02-11 15:17 ` [PATCH v4 15/15] Update MAINTAINERS and CREDITS with habanalabs info Oded Gabbay
2019-02-14  7:11 ` [PATCH v4 00/15] Habana Labs kernel driver Greg KH
2019-02-14  7:13   ` Oded Gabbay
2019-02-14  9:58     ` Oded Gabbay
2019-02-14 10:07       ` Greg KH
2019-02-14 10:15         ` Oded Gabbay
2019-02-14 10:37           ` Greg KH [this message]
2019-02-14 10:45             ` Oded Gabbay
2019-02-14 11:04               ` Greg KH
2019-02-14 11:40                 ` Oded Gabbay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190214103720.GA6518@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oded.gabbay@gmail.com \
    --cc=ogabbay@habana.ai \
    --cc=olof@lixom.net \
    --cc=rppt@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).