Re: Regression found (Stop-marking-clocks-as-CLK_IS_CRITICAL)

2019-01-17 Thread Johannes Stezenbach
On Thu, Jan 17, 2019 at 01:05:35PM +0100, Hans de Goede wrote:
> On 17-01-19 10:12, Dean Wallace wrote:
> > On 17-01-19, Mogens Jensen wrote:
> > > Kernel is compiled with SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH and the 
> > > quirk seems to have fixed the problem caused by commit 648e921888ad 
> > > ("clk: x86: Stop marking clocks as CLK_IS_CRITICAL"), as sound is now 
> > > working if running "speaker-test" on my system which is clean ALSA.
> 
> Note being "clean ALSA" is really not a good thing now a days,
> for lots of things we depend on pulseaudio (like setting
> up UCM mixer profiles).

FWIW I disagree because PA never worked for me.  I simply used
"alsaucm -c chtcx2072x set _verb HiFi".  But I was surprised
that PA does the ALSA UCM setup but it's not documented well that
you need to do it by other means if you don't use PA.
https://bugzilla.kernel.org/show_bug.cgi?id=115531#c72


Regards,
Johannes


Re: [PATCH] PM: Document rules on using pm_runtime_resume() in system suspend callbacks

2017-09-21 Thread Johannes Stezenbach
On Thu, Sep 21, 2017 at 02:39:30AM +0200, Rafael J. Wysocki wrote:
> On Wed, Sep 20, 2017 at 6:27 PM, Johannes Stezenbach  wrote:
> >
> >  E.g. an audio codec could keep running
> > while the i2c bus used to program its registers can be runtime suspended.
> > If this is correct I think it would be useful to spell it out explicitly
> > in the documentation.
> 
> That's because the i2c bus uses the ignore_children flag that allows
> it to override the general rules. :-)

Ah!  I was looking at Documentation/driver-api/pm only (which is
changed by your patch), but this is documented in Documentation/power
(and obviously I hadn't checked the code, shame on me).

> direct_complete has nothing to do with this.

Oh?  Reading again, do I get this right:

1. simple method: always call pm_runtime_resume() in ->suspend(),
   then suspend the driver again
2. optimization: if pm_runtime_suspended(), the driver's ->suspend()
   can possibly do nothing if conditions permit, otherwise it calls
   pm_runtime_resume() and then suspends
3. optimization: tell pm core to skip ->suspend() via return value
   from ->prepare() which sets direct_complete

...and your patch only deals with 1 and 2.

Sorry to hijack your thread for side discussion, it was
inadvertant due to my lack of understanding.


> First off, the PM core does check the direct_complete flag in
> __device_suspend() and does more-or-less what you are saying.
> 
> However, that flag is initialized in device_prepare() with the help of
> the ->suspend() return value, because whether or not it makes sense to

you mean ->prepare(), right?

> set that flag depends on some conditions that may change between
> consecutive system suspend-resume cycles in general and need to be
> checked in advance before setting it.
> 
> HTH

It does, however the question remains *why* it needs to check
it in ->prepare() and not right before calling ->suspend().
Using ->prepare() for the purpose seems wrong since it traverses
the hierarchy in the "wrong" order.  Only right before
calling ->suspend() the driver knows if its current state
allows it to skip any further actions for suspend, because
suspending children or other users may cause pm_runtime_resume()
for it.  (In the back of my head I have the scenario of
bug #196861, some completely different driver uses
i2c via ACPI OpRegion during its suspend.)


Thanks,
Johannes


Re: [PATCH] PM: Document rules on using pm_runtime_resume() in system suspend callbacks

2017-09-20 Thread Johannes Stezenbach
On Wed, Sep 20, 2017 at 04:01:32PM +0200, Rafael J. Wysocki wrote:
> On Wed, Sep 20, 2017 at 2:28 PM, Ulf Hansson  wrote:
> > On 20 September 2017 at 02:26, Rafael J. Wysocki  wrote:
> >>
> >> Second, leaving devices in runtime suspend in the "suspend" phase of system
> >> suspend is fishy even when their runtime PM is disabled, because that 
> >> doesn't
> >> guarantee anything regarding their children or possible consumers.  Runtime
> >> PM may still be enabled for those devices at that time and runtime resume 
> >> may
> >> be triggered for them later, in which case it all quickly falls apart.
> >
> > This is true, although to me this is a about a different problem and
> > has very little to do with pm_runtime_force_suspend().
> >
> > More precisely, whether runtime PM becomes disabled in the suspend
> > phase or suspend_late phase, really doesn't matter. Because in the end
> > this is about suspending/resuming devices in the correct order.
> 
> Yes, it is, but this is not my point (I didn't make it clear enough I guess).
> 
> At the time you make the decision to disable runtime PM for a parent
> (say) and leave it in runtime suspend, all of its children are
> suspended just fine (otherwise the parent wouldn't have been suspended
> too).  However, you *also* need to make sure that there will be no
> attempts to resume any of them *after* that point, which practically
> means that either runtime PM has to have been disabled already for all
> of them at the time it is disabled for the parent, or there has to be
> another guarantee in place.
> 
> That's why the core tries to enforce the "runtime PM disabled for the
> entire hierarchy below" guarantee for the devices with direct_complete
> set, but that may just be overkill in many cases.  I guess it may be
> better to use WARN_ON() to catch the cases in which things may really
> go wrong.

I read this half a dozen times and I'm still confused.
Moreover, Documentation/driver-api/pm/devices.rst says:

Runtime Power Management model:

Devices may also be put into low-power states while the system is
running, independently of other power management activity in principle.
However, devices are not generally independent of each other (for
example, a parent device cannot be suspended unless all of its child
devices have been suspended).  ...

However, isn't this a fundamental difference of runtime suspend
vs. system suspend that parent devices *can* be runtime suspended
before their children?  E.g. an audio codec could keep running
while the i2c bus used to program its registers can be runtime suspended.
If this is correct I think it would be useful to spell it out explicitly
in the documentation.

During system suspend, pm core will suspend children first,
and if the child's ->suspend hook uses the i2c bus to access registers,
it will implicitly runtime resume the i2c bus (e.g. due to pm_runtime_get_sync()
in i2c_dw_xfer()).  Later pm core will ->suspend the i2c bus.

I have a hunch the root of the problem is that ->prepare walks the tree
in top-down order, and its return value is used to decide about
direct-complete.  Why does it do that?  Shouldn't pm core check
the direct_complete flag during ->suspend if the device
is in runtime suspend, to decide whether to skip runtime resume + ->suspend
for *this* device?


Johannes


Re: [PATCH 2/3] input/keyboard: Add support for Dollar Cove TI power button

2017-08-22 Thread Johannes Stezenbach
On Tue, Aug 22, 2017 at 12:58:07PM +0200, Takashi Iwai wrote:
> I updated the patches and now pushed to topic/dollar-cove-ti-4.13-v2
> branch.  Will resubmit v2 (tomorrow or later) once after gathering
> reviews.

FWIW I tested current Linus's master + topic/dollar-cove-ti-4.13-v2
+ topic/soc-cx2072x-4.13 + my test patches, no observable
difference to topic/dollar-cove-ti-4.13 on E200HA.

Still hoping someone would give me a hint about possible
causes for the SoC entering S0i1 only instead of S0i3?
(https://bugzilla.kernel.org/show_bug.cgi?id=193891)
Where do I start looking?

Thanks,
Johannes


Re: Cherryview wake up events

2017-02-09 Thread Johannes Stezenbach
On Thu, Feb 02, 2017 at 05:58:26PM +0200, Mika Westerberg wrote:
> On Thu, Feb 02, 2017 at 04:42:43PM +0100, Johannes Stezenbach wrote:
> > On Thu, Feb 02, 2017 at 05:02:12PM +0200, Mika Westerberg wrote:
> > > Is the model Asus E200HA? Something like this (sorry the information is
> > > in Finnish but the machine should look the same):
> > > 
> > > https://www.karkkainen.com/verkkokauppa/asus-e200ha-fd0005ts-11-6--hd-kannettava-tietokone
> > 
> > Looks right, mine is E200HA-FD0004TS but I think that just means dark blue 
> > color.
> 
> OK, we have one other Cherrytrail machine here which may have the same
> PMIC. We'll check that first and if it does not have the same, I'll
> order the above machine.

Probably it's too early to ask, but did you go for the E200HA
or what device are you going to use?  And did you start poking
at it, or what timeframe can we expect some patches to test?

BTW, just to clarify about the test patches I added in bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=193891
You can use them but I also don't mind if they go to the
garbage can, they were just quickly cobbled together
for testing.


Thanks,
Johannes


Re: Cherryview wake up events

2017-02-03 Thread Johannes Stezenbach
On Fri, Feb 03, 2017 at 12:00:00PM +0200, Mika Westerberg wrote:
> Just for book keeping purposes, can you file a kernel.org bugzilla bug
> about this and add all the necessary information, and your patches
> there? You can assign the bug directly to me.

I filed it but cannot assign it, added you to CC.
https://bugzilla.kernel.org/show_bug.cgi?id=193891

Thanks,
Johannes


Re: Cherryview wake up events

2017-02-02 Thread Johannes Stezenbach
On Thu, Feb 02, 2017 at 05:58:26PM +0200, Mika Westerberg wrote:
> On Thu, Feb 02, 2017 at 04:42:43PM +0100, Johannes Stezenbach wrote:
> > On Thu, Feb 02, 2017 at 05:02:12PM +0200, Mika Westerberg wrote:
> > > Is the model Asus E200HA? Something like this (sorry the information is
> > > in Finnish but the machine should look the same):
> > > 
> > > https://www.karkkainen.com/verkkokauppa/asus-e200ha-fd0005ts-11-6--hd-kannettava-tietokone
> > 
> > Looks right, mine is E200HA-FD0004TS but I think that just means dark blue 
> > color.
> 
> OK, we have one other Cherrytrail machine here which may have the same
> PMIC. We'll check that first and if it does not have the same, I'll
> order the above machine.

In case it is useful to know, I installed Debian stretch following this:
https://wiki.debian.org/InstallingDebianOn/Asus/E200HA

I built my kernel using a relatively minimal kernel config,
let me know if you want it.  I could also post the
two patches which port the mfd and opregion drivers, but
they are straight forward copies of intel_soc_pmic_crc.c
and intel_pmic_crc.c from 4.10.0-rc6+ with code copy&pasted
from the ProductionKernelQuilts patches and s/crc/dc_ti/ etc.,
except I scamped the thermal handler to skip the ADC driver port for now.


Maybe I should've used intel_pmic_xpower.c instead of
intel_pmic_crc.c, since as I write this I see there
is a no-op intel_xpower_pmic_gpio_handler() registered.
This is the trick that fixes this:
\_SB.PCI0.I2C7.PMI2.AVBG Integer  8be7b74d9be0 01 = 
0001

But now it generates ACPI errors about thermal zone
and "acpi -V" usually hangs it up.

[5.500927] ACPI Exception: AE_ERROR, Returned by Handler for 
[UserDefinedRegion] (20160930/evregion-300)
[5.503842] No Local Variables are initialized for method [TMPR]
[5.506703] No Arguments are initialized for method [TMPR]
[5.509557] ACPI Error: Method parse/execution failed [\_SB.ATKD.TMPR] (Node 
8a7d374e87f8), AE_ERROR (20160930/ps
parse-543)
[5.512481] ACPI Error: Method parse/execution failed [\_SB.ATKD.WMNB] (Node 
8a7d374e7ed8), AE_ERROR (20160930/ps
parse-543)
[6.545403] i2c_designware 808622C1:06: controller timed out
[6.550763] ACPI Exception: AE_ERROR, Returned by Handler for 
[UserDefinedRegion] (20160930/evregion-300)
[6.555783] No Local Variables are initialized for method [TMPR]
[6.558769] No Arguments are initialized for method [TMPR]
[6.561571] ACPI Error: Method parse/execution failed [\_SB.ATKD.TMPR] (Node 
8a7d374e87f8), AE_ERROR (20160930/ps
parse-543)
[6.564487] ACPI Error: Method parse/execution failed [\_SB.ATKD.WMNB] (Node 
8a7d374e7ed8), AE_ERROR (20160930/ps
parse-543)

(I knew my thermal opregion code was preliminary but I didn't expect it to 
error.)


Thanks,
Johannes


Re: Cherryview wake up events

2017-02-02 Thread Johannes Stezenbach
On Thu, Feb 02, 2017 at 05:02:12PM +0200, Mika Westerberg wrote:
> OK, I guess it is easier if I just order one of those machines here and
> figure out how to get the PMIC driver working.

Oh, I assumed the bottleneck is developer time, not lack of hardware...

> Is the model Asus E200HA? Something like this (sorry the information is
> in Finnish but the machine should look the same):
> 
> https://www.karkkainen.com/verkkokauppa/asus-e200ha-fd0005ts-11-6--hd-kannettava-tietokone

Looks right, mine is E200HA-FD0004TS but I think that just means dark blue 
color.

> Also can you remind me what exactly is not working so we can prioritize?

There are reports hibernate isn't working, presumably because
the storage is 32MB eMMC.  I've never tried.  It doesn't
support ACPI S3 (suspend-to-RAM).  So currently one has
to boot+shutdown everytime (or keep it running).

1. There seems to be no way to wake it up after "echo freeze >/sys/power/state".
   That is the reason for wanting the power button to wake it up.
   Whether the PB creates an input event is secondary.
   (the LID also doesn't wake it up, but it creates an input event)
2. I've no idea what would be the power consumption in freeze state,
   so I guess support for the S0ix states is needed
3. It randomly hangs at boot, often with a message related to i2c timeout.
   I tried Hans de Goede's patches but it didn't work for me
   (question is if the semphore address is the same for
   AXP288 and TI DCove; the DSDT has the _SEM method so the
   semphore is needed).

Everything else is secondary.  E.g. there is an ADC driver used for thermal
used by the opregion driver, I didn't port it and just implemented
like for AXP288 by simple register reads (which might not work for TI).
We could fix this later.


Thanks,
Johannes


Re: Cherryview wake up events

2017-02-02 Thread Johannes Stezenbach
On Thu, Feb 02, 2017 at 04:26:18PM +0200, Mika Westerberg wrote:
> On Thu, Feb 02, 2017 at 02:52:57PM +0100, Johannes Stezenbach wrote:
> > Looking at 0002-GPIO-Adding-AXP288-PMIC-GPIO-driver.patch from 
> > ProductionKernelQuilts,
> > it doesn't seem hard to do the same for the TI PMIC, but it needs 
> > information
> > from the PMIC datasheet for irq and gpio control registers.
> > Hopefully you have a patch or at least could provide the information.
> 
> That patch looks like a GPIO driver for DCOVE. Did you try it already?

Hell, no.  Without datasheets I can't compare if registers
are compatible between AXP288 and TI DDOVE (SND9039).
Couldn't it damager the hardware if I mess up charger
and voltage regulator related registers?

And current Linus' tree doesn't have the AXP288 GPIO,
and ProductionKernelQuilts doesn't use AXP288 GPIO
for TI DCOVE.

Thanks,
Johannes


Re: Cherryview wake up events

2017-02-02 Thread Johannes Stezenbach
On Thu, Feb 02, 2017 at 02:16:39PM +0200, Mika Westerberg wrote:
> On Thu, Feb 02, 2017 at 01:35:08PM +0200, Mika Westerberg wrote:
> > On Thu, Feb 02, 2017 at 12:12:22PM +0100, Johannes Stezenbach wrote:
> > > On Thu, Feb 02, 2017 at 12:31:22PM +0200, Mika Westerberg wrote:
> > > > On Thu, Feb 02, 2017 at 10:52:00AM +0100, Johannes Stezenbach wrote:
> > > > > OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0100)
> > > > > Field (GPOP, ByteAcc, NoLock, Preserve)
> > > > > {
> > > > > Connection (
> > > > > GpioIo (Exclusive, PullDefault, 0x, 
> > > > > 0x, IoRestrictionOutputOnly,
> > > > > "\\_SB.PCI0.I2C7.PMI2", 0x00, 
> > > > > ResourceConsumer, ,
> > > > > )
> > > > > {   // Pin list
> > > > > 0x0020
> > > > > }
> > > > > ), 
> > > > > GMP0,   1, 
> > > > > ...
> > > > > (repeat for many more pins)
> > > > > 
> > > > > I guess it means it uses chv_gpio pins and can't work
> > > > > if the GPIO opregion is not registered?
> > > > 
> > > > That is using GPIO pins of the PMI2 device - the PMIC GPIO driver, I
> > > > suppose.
> > > > 
> > > > So in addition to the PMIC MFD driver, you need to have a GPIO driver
> > > > for Dollar Cove (I guess the quilt patch series included that as well?).
> > > 
> > > Nope, I see it for AX288 but didn't find it for TI DCove.  And in
> > > current Linus' tree axp288_cells[] doesn't include gpio so
> > > I concluded it's not needed... what am I missing?
> > 
> > So reading your DSDT there is that GPIO button array device \_SB.TBAD
> > which has one GpioInt() referencing \_SB.PCI0.I2C7.PMI2. I suppose that
> > is the power button GPIO.
> > 
> > In order to use that there needs to be a GPIO driver exposing those
> > GPIOs to other drivers. So it is definitely needed.
> 
> Actually, looking again the patches you found:
> 
> https://github.com/01org/ProductionKernelQuilts/blob/master/uefi/cht-m1stable/patches/mfd-intel_soc_pmic-add-TI-variant-of-dollar-cove.patch
> https://github.com/01org/ProductionKernelQuilts/blob/master/uefi/cht-m1stable/patches/PWRBTN-add-driver-for-TI-PMIC.patch
> 
> Did you try to them both? The latter seems to handle the power button
> by talking directly with the PMIC (instead of using a GPIO).

Nope, as I've written earlier:
> In ProductionKernelQuilts I found
> DC-TI-PMIC-disable-power-button-support.patch so I guess it
> might not be needed because it's probably handled by ACPI.

[  +0.000338] input: Power Button as 
/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input0
[  +0.000127] ACPI: Power Button [PWRB]
...
[  +0.000248] input: Power Button as 
/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3
[  +0.000116] ACPI: Power Button [PWRF]

And I also have:

[  +0.04] soc_button_array INTCFD9:00: GPIO lookup for consumer 
soc_button_array
[  +0.02] soc_button_array INTCFD9:00: using ACPI for GPIO lookup
[  +0.03] acpi INTCFD9:00: GPIO: looking up soc_button_array-gpios
[  +0.04] acpi INTCFD9:00: GPIO: looking up soc_button_array-gpio
[  +0.03] acpi INTCFD9:00: GPIO: looking up 0 in _CRS
[  +0.000610] soc_button_array INTCFD9:00: lookup for GPIO soc_button_array 
failed
(repeats for 5 buttons, one of them should succeed)

> Let's include the original author (Ramakrishna) as well if we could get
> some information from him.

Looking at 0002-GPIO-Adding-AXP288-PMIC-GPIO-driver.patch from 
ProductionKernelQuilts,
it doesn't seem hard to do the same for the TI PMIC, but it needs information
from the PMIC datasheet for irq and gpio control registers.
Hopefully you have a patch or at least could provide the information.


Thanks,
Johannes


Re: Cherryview wake up events

2017-02-02 Thread Johannes Stezenbach
On Thu, Feb 02, 2017 at 12:31:22PM +0200, Mika Westerberg wrote:
> On Thu, Feb 02, 2017 at 10:52:00AM +0100, Johannes Stezenbach wrote:
> > OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0100)
> > Field (GPOP, ByteAcc, NoLock, Preserve)
> > {
> > Connection (
> > GpioIo (Exclusive, PullDefault, 0x, 0x, 
> > IoRestrictionOutputOnly,
> > "\\_SB.PCI0.I2C7.PMI2", 0x00, ResourceConsumer, 
> > ,
> > )
> > {   // Pin list
> > 0x0020
> > }
> > ), 
> > GMP0,   1, 
> > ...
> > (repeat for many more pins)
> > 
> > I guess it means it uses chv_gpio pins and can't work
> > if the GPIO opregion is not registered?
> 
> That is using GPIO pins of the PMI2 device - the PMIC GPIO driver, I
> suppose.
> 
> So in addition to the PMIC MFD driver, you need to have a GPIO driver
> for Dollar Cove (I guess the quilt patch series included that as well?).

Nope, I see it for AX288 but didn't find it for TI DCove.  And in
current Linus' tree axp288_cells[] doesn't include gpio so
I concluded it's not needed... what am I missing?


Thanks,
Johannes


Re: Cherryview wake up events

2017-02-02 Thread Johannes Stezenbach
Hi Mika,

On Tue, Jan 31, 2017 at 03:37:40PM +0100, Johannes Stezenbach wrote:
> - Powerbutton driver seems simple enough, the only specialty
>   of the TI dcove PB driver is the workarond for lost button
>   press event after resume.  However, I still don't see how
>   the PB would cause thermal event irqs on E200HA and how the
>   PMIC driver would change it?

In ProductionKernelQuilts I found
DC-TI-PMIC-disable-power-button-support.patch so I guess it
might not be needed because it's probably handled by ACPI.

> I think the mfd driver would be similar to intel_soc_pmic_crc.c,
> the dollar_cove_ti_powerbtn.c I would keep instead of merging
> it into intel_mid_powerbtn.c.  I guess what we need is in
> drivers/acpi/pmic/ something similar to intel_pmic_crc.c,
> the ProductionKernelQuilts has 
> 0001-ACPI-Adding-support-for-TI-pmic-opregion.patch.

I have preliminary versions of the mfd and opregion driver,
while testing I found the GPIO opregion is not registered:

Excerpt from DSDT:
https://linuxtv.org/~js/e200ha/dsdt.dsl

Device (PMI2)
{
Name (_ADR, Zero)  // _ADR: Address
Name (_HID, "INT33F5" /* TI PMIC Controller */)  // _HID: 
Hardware ID
Name (_CID, "INT33F5" /* TI PMIC Controller */)  // _CID: 
Compatible ID
Name (_DDN, "TI PMIC Controller")  // _DDN: DOS Device Name
Name (_HRV, 0x03)  // _HRV: Hardware Revision
Name (_UID, One)  // _UID: Unique ID
Name (_DEP, Package (0x02)  // _DEP: Dependencies
{
I2C7, 
GPO1
})
Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource 
Settings
{
Name (SBUF, ResourceTemplate ()
{
I2cSerialBusV2 (0x005E, ControllerInitiated, 0x000F4240,
AddressingMode7Bit, "\\_SB.PCI0.I2C7",
0x00, ResourceConsumer, , Exclusive,
)
GpioInt (Level, ActiveHigh, Shared, PullDefault, 0x,
"\\_SB.GPO1", 0x00, ResourceConsumer, ,
)
{   // Pin list
0x000F
}
})
Return (SBUF) /* \_SB_.PCI0.I2C7.PMI2._CRS.SBUF */
}
...
Name (AVBL, Zero)
Name (AVBD, Zero)
Name (AVBG, Zero)
Method (_REG, 2, NotSerialized)  // _REG: Region Availability
{
If (Arg0 == 0x08)
{
AVBG = Arg1
}

If (Arg0 == 0x8D)
{
AVBL = Arg1
}

If (Arg0 == 0x8C)
{
AVBD = Arg1
}
}


acpidbg:
\_SB.PCI0.I2C7.PMI2.AVBL Integer  8be7b74d97a8 01 = 
0001
\_SB.PCI0.I2C7.PMI2.AVBD Integer  8be7b74d94d8 01 = 
0001
\_SB.PCI0.I2C7.PMI2.AVBG Integer  8be7b74d9be0 01 = 


Any idea about it?
devm_gpiochip_add_data() in chv_gpio_probe() indirectly calls 
acpi_gpiochip_add()
which should use _DEP to figure out to call _REG, right?

Also PMI2 has

OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0100)
Field (GPOP, ByteAcc, NoLock, Preserve)
{
Connection (
GpioIo (Exclusive, PullDefault, 0x, 0x, 
IoRestrictionOutputOnly,
"\\_SB.PCI0.I2C7.PMI2", 0x00, ResourceConsumer, ,
)
{   // Pin list
0x0020
}
), 
GMP0,   1, 
...
(repeat for many more pins)

I guess it means it uses chv_gpio pins and can't work
if the GPIO opregion is not registered?


FWIW, with the mfd driver, /proc/interrupts has

 180:  0  0  0  0  chv-gpio9  TI Dollar Cove

I guess the 9 refers to the 10th pin in north_pins[] which is pin 0x000F, right?
I boot with "dyndbg=file gpiolib* +p" and get

[  +0.012798] acpi INT33F5:00: GPIO: looking up 0 in _CRS
[  +0.000214] intel_soc_pmic_i2c i2c-INT33F5:00: GPIO lookup for consumer 
intel_soc_pmic
[  +0.03] intel_soc_pmic_i2c i2c-INT33F5:00: using ACPI for GPIO lookup
[  +0.05] acpi INT33F5:00: GPIO: looking up intel_soc_pmic-gpios
[  +0.05] acpi INT33F5:00: GPIO: looking up intel_soc_pmic-gpio
[  +0.05] acpi INT33F5:00: GPIO: lo

Re: Cherryview wake up events

2017-01-31 Thread Johannes Stezenbach
Hi Andy and Mika,

On Tue, Jan 31, 2017 at 12:05:07AM +0200, Andy Shevchenko wrote:
> On Mon, Jan 30, 2017 at 10:57 PM, Johannes Stezenbach  wrote:
> >
> > I checked the reference source code, my impression is the
> > TI Dollar Cove and and AXP288 are completely different hardware.
> 
> Thanks for checking.
> 
> Yes, due to not obvious communication to PMIC. I suppose that the IP
> core is quite similar in all of them, the difference is just how OS
> and other MCUs in SoC communicate with it.
> 
> So, basically what it means that I2C direct communication is prohibited here.

Not sure about that, but I guess this is needed:
https://lists.freedesktop.org/archives/intel-gfx/2017-January/117696.html

> >> > This is known: http://www.spinics.net/lists/intel-gfx/msg117738.html
> >
> > Interestingly via this link I found Intel also published
> > the TI DCove source in a patch series against an unspecified kernel:
> > https://github.com/01org/ProductionKernelQuilts
> > specifically
> > https://github.com/01org/ProductionKernelQuilts/blob/master/uefi/cht-m1stable/patches/mfd-intel_soc_pmic-add-TI-variant-of-dollar-cove.patch
> > https://github.com/01org/ProductionKernelQuilts/blob/master/uefi/cht-m1stable/patches/PWRBTN-add-driver-for-TI-PMIC.patch
> > and some more (the series is quite messy).

FWIW, now I came across yet another source for this driver:
https://android.googlesource.com/kernel/x86/+/android-x86-grant-3.10-marshmallow-mr1-wear-release/drivers/external_drivers/drivers/mfd/intel_pmic/
(but seems to be older)

> > For the Asus E200HA I'm not sure if the charger and coulomb
> > counter drivers are needed since charging just works and
> > the battery status is reported via ACPI.  It seems these
> > drivers are only for tablets without ACPI support, right?
> 
> Have no idea.
> 
> What that code reminds me is MID family of devices. So, power button
> is (reasonable) easy to get support of in that case.
> Look into drivers/platform/x86/intel_mid_powerbtn.c. I recently
> updated it to support Basin Cove on Intel Edison.

You seem to suggest I should try and tackle it myself,
which I would do, but for one I don't want to step on
Mika's toes, secondly ISTR you indicated you have newer,
better source than what is available publicly?
If you want me to take it, please let me know which tree
to work against and any other suggestions you have.

Some more questions:
- Powerbutton driver seems simple enough, the only specialty
  of the TI dcove PB driver is the workarond for lost button
  press event after resume.  However, I still don't see how
  the PB would cause thermal event irqs on E200HA and how the
  PMIC driver would change it?
- Wakeup from freeze state (E200HA doesn't support suspend / ACPI S3)
  is only step 1, to make it usable we need S0ix support.
  Any hints about that?

I think the mfd driver would be similar to intel_soc_pmic_crc.c,
the dollar_cove_ti_powerbtn.c I would keep instead of merging
it into intel_mid_powerbtn.c.  I guess what we need is in
drivers/acpi/pmic/ something similar to intel_pmic_crc.c,
the ProductionKernelQuilts has 
0001-ACPI-Adding-support-for-TI-pmic-opregion.patch.


Thanks,
Johannes


Re: Cherryview wake up events

2017-01-30 Thread Johannes Stezenbach
On Fri, Jan 27, 2017 at 02:30:58PM +0100, Johannes Stezenbach wrote:
> On Fri, Jan 27, 2017 at 03:21:22PM +0200, Andy Shevchenko wrote:
> > On Fri, Jan 27, 2017 at 1:38 PM, Johannes Stezenbach  wrote:
> > > On Fri, Jan 27, 2017 at 12:56:53AM +0200, Andy Shevchenko wrote:
> > 
> > >> Had you tried to add ID to axp20x-i2c.c ?
> > >
> > > Nope, since I have no idea if the axp and TI hardware is similar.
> > 
> > I think you would give a try.
> 
> I'll check it.

I checked the reference source code, my impression is the
TI Dollar Cove and and AXP288 are completely different hardware.

> > > [5.331709] i2c_designware 808622C1:06: controller timed out
> > >
> > This is known: http://www.spinics.net/lists/intel-gfx/msg117738.html

Interestingly via this link I found Intel also published
the TI DCove source in a patch series against an unspecified kernel:
https://github.com/01org/ProductionKernelQuilts
specifically
https://github.com/01org/ProductionKernelQuilts/blob/master/uefi/cht-m1stable/patches/mfd-intel_soc_pmic-add-TI-variant-of-dollar-cove.patch
https://github.com/01org/ProductionKernelQuilts/blob/master/uefi/cht-m1stable/patches/PWRBTN-add-driver-for-TI-PMIC.patch
and some more (the series is quite messy).

For the Asus E200HA I'm not sure if the charger and coulomb
counter drivers are needed since charging just works and
the battery status is reported via ACPI.  It seems these
drivers are only for tablets without ACPI support, right?


Thanks,
Johannes


Re: Cherryview wake up events

2017-01-27 Thread Johannes Stezenbach
On Fri, Jan 27, 2017 at 03:21:22PM +0200, Andy Shevchenko wrote:
> On Fri, Jan 27, 2017 at 1:38 PM, Johannes Stezenbach  wrote:
> > On Fri, Jan 27, 2017 at 12:56:53AM +0200, Andy Shevchenko wrote:
> 
> > And the same info is also in sysfs:
> >
> > # cat 
> > /sys/devices/LNXSYSTM\:00/LNXSYBUS\:00/PNP0A08\:00/808622C1\:06/INT33F4\:00/status
> > 0
> > # cat 
> > /sys/devices/LNXSYSTM\:00/LNXSYBUS\:00/PNP0A08\:00/808622C1\:06/INT33F5\:00/status
> > 15
> >
> > The DSDT is still at https://linuxtv.org/~js/e200ha/
> >
> >> Had you tried to add ID to axp20x-i2c.c ?
> >
> > Nope, since I have no idea if the axp and TI hardware is similar.
> 
> I think you would give a try.

I'll check it.

> > There might be more issues, currently the machine hangs often
> > during bootup at random points.  I built i915 as a module and
> > blacklisted it for autoloading so I can read the last message
> > on the console.  All I can say is that it is more likely to
> > hang when the loglevel is high, i.e. it almost never succeeds
> > with "debug" on kernel command line.  Sometimes there are
> > timeout errors from I2C:
> > [4.307189] i2c_designware 808622C1:06: controller timed out
> > [5.331709] i2c_designware 808622C1:06: controller timed out
> >
> > Once it has booted it is running stable.
> 
> This is known: http://www.spinics.net/lists/intel-gfx/msg117738.html

Not sure because it happens with i915 module not loaded
(currently I load it manually after boot completed).
But thanks for the link.

Johannes


Re: Cherryview wake up events

2017-01-27 Thread Johannes Stezenbach
On Fri, Jan 27, 2017 at 12:56:53AM +0200, Andy Shevchenko wrote:
> 
> I'm reading your long thread about the issue.

Thanks for taking the time!

> > but excluded CONFIG_MFD_AXP20X based on \_SB.PIC0.I2C7.PMI1._STA returning 
> > 0 in acpidbg,
> > but \_SB.PIC0.I2C7.PMI1._STA returns 0xf
> 
> Did you mean PMI2 in the second sentence?

Yes, sorry for copy & paste mistake.  I just repated to confirm:
In acpidbg:

- execute \_SB.PCI0.I2C7.PMI1._STA
Evaluating \_SB.PCI0.I2C7.PMI1._STA
Evaluation of \_SB.PCI0.I2C7.PMI1._STA returned object a14a6742, 
external buffer length 18
 [Integer] = 

- execute \_SB.PCI0.I2C7.PMI2._STA
Evaluating \_SB.PCI0.I2C7.PMI2._STA
Evaluation of \_SB.PCI0.I2C7.PMI2._STA returned object a14a6742, 
external buffer length 18
 [Integer] = 000F

And the same info is also in sysfs:

# cat 
/sys/devices/LNXSYSTM\:00/LNXSYBUS\:00/PNP0A08\:00/808622C1\:06/INT33F4\:00/status
0
# cat 
/sys/devices/LNXSYSTM\:00/LNXSYBUS\:00/PNP0A08\:00/808622C1\:06/INT33F5\:00/status
15

The DSDT is still at https://linuxtv.org/~js/e200ha/

> Had you tried to add ID to axp20x-i2c.c ?

Nope, since I have no idea if the axp and TI hardware is similar.

There might be more issues, currently the machine hangs often
during bootup at random points.  I built i915 as a module and
blacklisted it for autoloading so I can read the last message
on the console.  All I can say is that it is more likely to
hang when the loglevel is high, i.e. it almost never succeeds
with "debug" on kernel command line.  Sometimes there are
timeout errors from I2C:
[4.307189] i2c_designware 808622C1:06: controller timed out
[5.331709] i2c_designware 808622C1:06: controller timed out

Once it has booted it is running stable.


Thanks,
Johannes


Re: Cherryview wake up events

2017-01-24 Thread Johannes Stezenbach
On Tue, Jan 24, 2017 at 04:28:29PM +0200, Andy Shevchenko wrote:
> They probably release just almost all One Big Ugly patch from official
> BSP, which by some reason, includes all Intel MID SoCs, Baytrail.
> I think I know how Dollar Cove related code ended up there. But that
> all stuff is a total mess.

I agree.  Probably it was a mistake to bring up this code here.
Let me try to go back two steps:  Could you please let me
know if there is any progress in mainlining the TI Dollar Cove PMIC
and related drivers?  Is there a schedule?
After waiting for four months I'm actually getting impatient
because by now the Cherryview based hardware seems to go out
of production and I fear the mainlining might never happen.

Thanks,
Johannes


Re: Cherryview wake up events

2017-01-24 Thread Johannes Stezenbach
On Tue, Jan 24, 2017 at 01:14:16PM +0200, Andy Shevchenko wrote:
> On Tue, Jan 24, 2017 at 11:41 AM, Johannes Stezenbach  wrote:
> > Meanwhile I found out the TI PMIC and power button drivers
> > has been published as part of the Asus ZenFone Zoom (ZX551ML)
> > Android kernel code drop (based on linux-3.10.x):
> >
> > https://www.asus.com/support/Download/39/1/0/26/BXbNqJplzZiLmk6G/32/
> >
> > Please let me know if there is anything I could do
> > to help get it mainlined soon.
> 
> AFAIK ASuS Zenfone 2 (Intel based) series uses Intel Moorefield. It
> has ShadyCove PMIC.

So Asus released more than they needed.  I confirmed their
source drop contains the TI Dollar Cove driver (dollar_cove_ti.c).
iPreviously I searched for Android devices using CherryView but the
only one I could find is Xioami MiPad 2 and it's released
kernel source doesn't contain the driver.

Anyway, let me know if I can help to get it into mainline soon.


Johannes


Re: Cherryview wake up events

2017-01-24 Thread Johannes Stezenbach
Hi,

On Mon, Dec 05, 2016 at 01:06:08PM +0200, Mika Westerberg wrote:
> On Sun, Dec 04, 2016 at 07:52:19PM +0100, Johannes Stezenbach wrote:
> > On Wed, Oct 05, 2016 at 04:05:11PM +0300, Mika Westerberg wrote:
> > > On Wed, Oct 05, 2016 at 02:46:48PM +0200, Johannes Stezenbach wrote:
> > > > On Fri, Sep 23, 2016 at 11:19:04AM +0300, Mika Westerberg wrote:
> > > > > David (CC'd) is working on getting the Dollar Cove PMIC driver
> > > > > upstreamed to the mainline kernel.
> > > > 
> > > > May I ask when to expect a patch?  I'm ready if you
> > > > have something to test, even if it's not in
> > > > shape for mainline yet.
> > > 
> > > It typically takes quite some time to get all the legal stuff done
> > > before the code can be published. And if people are busy with other
> > > things it takes even more time.
> > > 
> > > So please be patient, it will happen sooner or later ;-)
> > 
> > I don't want to nag, but just so it doesn't drop off
> > the TODO list due to "lack of interest":  What's the
> > status?  Will Santa bring the the TI Dollar Cove PMIC driver?
> 
> David, do you have any estimate?


Meanwhile I found out the TI PMIC and power button drivers
has been published as part of the Asus ZenFone Zoom (ZX551ML)
Android kernel code drop (based on linux-3.10.x):

https://www.asus.com/support/Download/39/1/0/26/BXbNqJplzZiLmk6G/32/

Please let me know if there is anything I could do
to help get it mainlined soon.


Thanks,
Johannes


Re: Cherryview wake up events

2016-12-04 Thread Johannes Stezenbach
Hi,

On Wed, Oct 05, 2016 at 04:05:11PM +0300, Mika Westerberg wrote:
> On Wed, Oct 05, 2016 at 02:46:48PM +0200, Johannes Stezenbach wrote:
> > On Fri, Sep 23, 2016 at 11:19:04AM +0300, Mika Westerberg wrote:
> > > David (CC'd) is working on getting the Dollar Cove PMIC driver
> > > upstreamed to the mainline kernel.
> > 
> > May I ask when to expect a patch?  I'm ready if you
> > have something to test, even if it's not in
> > shape for mainline yet.
> 
> It typically takes quite some time to get all the legal stuff done
> before the code can be published. And if people are busy with other
> things it takes even more time.
> 
> So please be patient, it will happen sooner or later ;-)

I don't want to nag, but just so it doesn't drop off
the TODO list due to "lack of interest":  What's the
status?  Will Santa bring the the TI Dollar Cove PMIC driver?

While I'm at it, I also have questions about S0ix support
in Linux which I didn't find answers to by web search.
Does S0ix depend on the PMIC driver?  And will it be
used during run time or only in "sleep" state
(which would mean "echo freeze >/sys/power/state"
since ACPI S3 isn't supported)?
Now all I know is it doesn't seem to be used so far (running 4.9.0-rc7+):

/sys/kernel/debug/pmc_atom/sleep_state:S0IR Residency:  0us
/sys/kernel/debug/pmc_atom/sleep_state:S0I1 Residency:  0us
/sys/kernel/debug/pmc_atom/sleep_state:S0I2 Residency:  0us
/sys/kernel/debug/pmc_atom/sleep_state:S0I3 Residency:  0us
/sys/kernel/debug/pmc_atom/sleep_state:S0   Residency: 160934496us


Thanks,
Johannes


Re: [PATCH v2 18/31] gp8psk: don't do DMA on stack

2016-11-07 Thread Johannes Stezenbach
On Sun, Nov 06, 2016 at 11:51:14AM -0800, VDR User wrote:
> I applied this patch to the 4.8.4 kernel driver (that I'm currently
> running) and it caused nothing but "frontend 0/0 timed out while
> tuning". Is there another patch that should be used in conjunction
> with this? If not, this patch breaks the gp8psk driver.
> 
> Thanks.

Thanks for testing.  "If it's not tested it's broken"...

> On Tue, Oct 11, 2016 at 3:09 AM, Mauro Carvalho Chehab
>  wrote:

> > index 5d0384dd45b5..fa215ad37f7b 100644
> > --- a/drivers/media/usb/dvb-usb/gp8psk.c
> > +++ b/drivers/media/usb/dvb-usb/gp8psk.c

> >  int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 
> > index, u8 *b, int blen)
> >  {
> > +   struct gp8psk_state *st = d->priv;
> > int ret = 0,try = 0;
> >
> > if ((ret = mutex_lock_interruptible(&d->usb_mutex)))
> > return ret;
> >
> > while (ret >= 0 && ret != blen && try < 3) {
> > +   memcpy(st->data, b, blen);
> > ret = usb_control_msg(d->udev,
> > usb_rcvctrlpipe(d->udev,0),
> > req,
> > USB_TYPE_VENDOR | USB_DIR_IN,
> > -   value,index,b,blen,
> > +   value, index, st->data, blen,
> > 2000);

I guess for usb_in the memcpy should be after the usb_control_msg
and from st->data to b.

Johannes


Re: [PATCH v2 02/31] cinergyT2-core: don't do DMA on stack

2016-10-15 Thread Johannes Stezenbach
On Tue, Oct 11, 2016 at 07:09:17AM -0300, Mauro Carvalho Chehab wrote:
> --- a/drivers/media/usb/dvb-usb/cinergyT2-core.c
> +++ b/drivers/media/usb/dvb-usb/cinergyT2-core.c
> @@ -41,6 +41,8 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
>  
>  struct cinergyt2_state {
>   u8 rc_counter;
> + unsigned char data[64];
> + struct mutex data_mutex;
>  };

Sometimes my thinking is slow but it just occured to me
that this creates a potential issue with cache line sharing.
On an architecture which manages cache coherence in software
(ARM, MIPS etc.) a write to e.g. rc_counter in this example
would dirty the cache line, and a later writeback from the
cache could overwrite parts of data[] which was received via DMA.
In contrast, if the DMA buffer is allocated seperately via
kmalloc it is guaranteed to be safe wrt cache line sharing.
(see bottom of Documentation/DMA-API-HOWTO.txt).

But of course DMA on stack also had the same issue
and no one ever noticed so it's apparently not critical...


Johannes


Re: Problem with VMAP_STACK=y

2016-10-05 Thread Johannes Stezenbach
On Wed, Oct 05, 2016 at 06:04:50AM -0300, Mauro Carvalho Chehab wrote:
>  static int cinergyt2_frontend_attach(struct dvb_usb_adapter *adap)
>  {
> - char query[] = { CINERGYT2_EP1_GET_FIRMWARE_VERSION };
> - char state[3];
> + struct dvb_usb_device *d = adap->dev;
> + struct cinergyt2_state *st = d->priv;
>   int ret;
>  
>   adap->fe_adap[0].fe = cinergyt2_fe_attach(adap->dev);
>  
> - ret = dvb_usb_generic_rw(adap->dev, query, sizeof(query), state,
> - sizeof(state), 0);

it seems to miss this:

st->data[0] = CINERGYT2_EP1_GET_FIRMWARE_VERSION;

> + ret = dvb_usb_generic_rw(d, st->data, 1, st->data, 3, 0);
>   if (ret < 0) {
>   deb_rc("cinergyt2_power_ctrl() Failed to retrieve sleep "
>   "state info\n");
> @@ -141,13 +147,14 @@ static int repeatable_keys[] = {
>  static int cinergyt2_rc_query(struct dvb_usb_device *d, u32 *event, int 
> *state)
>  {
>   struct cinergyt2_state *st = d->priv;
> - u8 key[5] = {0, 0, 0, 0, 0}, cmd = CINERGYT2_EP1_GET_RC_EVENTS;
>   int i;
>  
>   *state = REMOTE_NO_KEY_PRESSED;
>  
> - dvb_usb_generic_rw(d, &cmd, 1, key, sizeof(key), 0);
> - if (key[4] == 0xff) {
> + st->data[0] = CINERGYT2_EP1_SLEEP_MODE;

should probably be

st->data[0] = CINERGYT2_EP1_GET_RC_EVENTS;

> +
> + dvb_usb_generic_rw(d, st->data, 1, st->data, 5, 0);


HTH,
Johannes


Re: Cherryview wake up events

2016-10-05 Thread Johannes Stezenbach
On Fri, Sep 23, 2016 at 11:19:04AM +0300, Mika Westerberg wrote:
> David (CC'd) is working on getting the Dollar Cove PMIC driver
> upstreamed to the mainline kernel.

May I ask when to expect a patch?  I'm ready if you
have something to test, even if it's not in
shape for mainline yet.

Thanks,
Johannes


Re: Cherryview wake up events

2016-09-23 Thread Johannes Stezenbach
On Fri, Sep 23, 2016 at 11:19:04AM +0300, Mika Westerberg wrote:
> On Wed, Sep 21, 2016 at 11:16:35AM +0200, Johannes Stezenbach wrote:
> > There is an ADBG ("TI_DCOVE") in PMI2._STA, so Dollar Cove
> > sounds like a good guess.
> 
> David (CC'd) is working on getting the Dollar Cove PMIC driver
> upstreamed to the mainline kernel.

Excellent news!  Repeating essential info to avoid any
confusion, the PMIC is

Device (PMI2)
{
Name (_ADR, Zero)  // _ADR: Address
Name (_HID, "INT33F5" /* TI PMIC Controller */)  // _HID: 
Hardware ID
Name (_CID, "INT33F5" /* TI PMIC Controller */)  // _CID: 
Compatible ID
Name (_DDN, "TI PMIC Controller")  // _DDN: DOS Device Name

(Because the INT33F4 XPOWER PMIC also has ADBG ("XPWR_DCOVE")
so I'm not sure "Dollar Cove" is a unique name.)


I put the Asus E200HA DSDT at
https://linuxtv.org/~js/e200ha/


Thanks,
Johannes


Re: Cherryview wake up events

2016-09-21 Thread Johannes Stezenbach
On Wed, Sep 21, 2016 at 12:06:14PM +0300, Mika Westerberg wrote:
> On Tue, Sep 20, 2016 at 11:11:53PM +0200, Johannes Stezenbach wrote:
> > Or it is because the PNP0C40 device depends on GpioInt from PMIC
> > which isn't available...
> > 
> > Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource 
> > Settings
> > {
> > Name (CBUF, ResourceTemplate ()
> > {
> > GpioInt (Edge, ActiveBoth, ExclusiveAndWake, PullUp, 
> > 0x0BB8,
> > "\\_SB.PCI0.I2C7.PMI2", 0x00, ResourceConsumer, ,
> > )
> > {   // Pin list
> > 0x0016
> > }
> > })
> > Return (CBUF) /* \_SB_.TBAD._CRS.CBUF */
> > }
> 
> Most likely this is the reason. I'll try to find if we have an existing
> driver for this PMIC somewhere. I guess this is the Dollar Cove which is
> successor of Crystal Cove IIRC which is already supported by the
> mainline kernel.

There is an ADBG ("TI_DCOVE") in PMI2._STA, so Dollar Cove
sounds like a good guess.


Thanks,
Johannes


Re: Cherryview wake up events

2016-09-20 Thread Johannes Stezenbach
On Tue, Sep 20, 2016 at 05:59:43PM +0200, Johannes Stezenbach wrote:
> On Tue, Sep 20, 2016 at 01:40:14PM +0300, Mika Westerberg wrote:
> > If yes, it probably does not have the normal Fixed power button but
> > instead it has something called "Windows button array device" with
> > _HID/_CID of PNP0C40. Looking at your dsdt.dsl, this looks to be the
> > case.
> > 
> > That device is driven by soc_button_array.c driver which can be enabled
> > with CONFIG_KEYBOARD_GPIO=y and CONFIG_INPUT_SOC_BUTTON_ARRAY=y. Can you
> > check if you have that enabled already?
> > 
> > You should actually see it in /proc/interrupts with names like "power"
> > and so on.
> 
> I added CONFIG_INPUT_SOC_BUTTON_ARRAY=y, but no joy.
> Maybe because the _HID is INTCFD9, only _CID is PNP0C40?
> It also has a _DSM with UUID dfbcf3c5-e7a5-44e6-9c1f-29c76f6e059c.

Or it is because the PNP0C40 device depends on GpioInt from PMIC
which isn't available...

Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
{
Name (CBUF, ResourceTemplate ()
{
GpioInt (Edge, ActiveBoth, ExclusiveAndWake, PullUp, 0x0BB8,
"\\_SB.PCI0.I2C7.PMI2", 0x00, ResourceConsumer, ,
)
{   // Pin list
0x0016
}
})
Return (CBUF) /* \_SB_.TBAD._CRS.CBUF */
}

Thanks,
Johannes


Re: Cherryview wake up events

2016-09-20 Thread Johannes Stezenbach
On Tue, Sep 20, 2016 at 01:40:14PM +0300, Mika Westerberg wrote:
> Can you check if you have:
> 
>   Hardware Reduced (V5) : 1
> 
> in that FADT table?

Nope, it is "Hardware Reduced (V5) : 0".  Now the FADT is also at
https://linuxtv.org/~js/e200ha/

> If yes, it probably does not have the normal Fixed power button but
> instead it has something called "Windows button array device" with
> _HID/_CID of PNP0C40. Looking at your dsdt.dsl, this looks to be the
> case.
> 
> That device is driven by soc_button_array.c driver which can be enabled
> with CONFIG_KEYBOARD_GPIO=y and CONFIG_INPUT_SOC_BUTTON_ARRAY=y. Can you
> check if you have that enabled already?
> 
> You should actually see it in /proc/interrupts with names like "power"
> and so on.

I added CONFIG_INPUT_SOC_BUTTON_ARRAY=y, but no joy.
Maybe because the _HID is INTCFD9, only _CID is PNP0C40?
It also has a _DSM with UUID dfbcf3c5-e7a5-44e6-9c1f-29c76f6e059c.

BTW, lsinput already lists two "Power Button" devices,
   phys: "PNP0C0C/button/input0"
   phys: "LNXPWRBN/button/input0"

None of them generates events in input-events.


Thanks,
Johannes


Re: Cherryview wake up events

2016-09-20 Thread Johannes Stezenbach
On Tue, Sep 20, 2016 at 12:18:40PM +0300, Mika Westerberg wrote:
> On Mon, Sep 19, 2016 at 10:36:22PM +0200, Johannes Stezenbach wrote:
> > Now my question is, is this pin 0x004E the same as this
> > in /proc/interrupts which fires on LID event?
> > 
> >  158:  2  0  0  0  chv-gpio   43 ACPI:Event
> 
> Yes, it is that one and it triggers \_SB.GPO0._E4E() method to be called
> whenever low edge is detected on the GPIO line. This method then handles
> many things depending on what the AML code reads from ^^PCI0.I2C1.ENID
> notifying the power button device (PWRB) among other things.

Thanks for confirmation, but it circles back to the question
how to map the numbers.  Since the document that describes it
is not public, it would be useful if you could add comments
to pinctrl-cherryview.c that describes it.
Or did I just miss something?

> I suppose you already have CONFIG_ACPI_I2C_OPREGION=y in your .config?
> That allows the AML code to access the I2C bus using the I2C driver.
> 
> > The FADT has
> > Control Method Power Button (V1) : 0
> > Control Method Sleep Button (V1) : 1
> > 
> > PWRBTN_EN in PM1 is set.  But PWRBTN press causes thermal irq.
> 
> Yeah, it uses control method power button (PNP0C0C) and ACPI GPIO event
> to trigger changes in that.

I'm confused again because I thought "Control Method Power Button (V1) : 0"
means it is a fixed power button, however the DSDT also has

Device (PWRB)
{
Name (_HID, EisaId ("PNP0C0C") /* Power Button Device */)  // _HID: 
Hardware ID
}

Device (SLPB)
{
Name (_HID, EisaId ("PNP0C0E") /* Sleep Button Device */)  // _HID: 
Hardware ID
}


> > No SCI (irq 9) is ever generated, except by writing to the
> > BIOS_RLS bit in SMI_EN register (IO port 0x430).
> > 
> > GPE block addresses in FADT are 0.  GPE0a_EN register (IO 0x428)
> > is set to 0x6000 (TCO_EN + PME_B0_EN, but none of the GPIO enables).
> > 
> > Any advice how to continue?
> 
> Please check that you have that CONFIG_ACPI_I2C_OPREGION=y and
> CONFIG_MFD_AXP20X=y.
> 
> You should see the ACPI:Event interrupt count increasing in
> /proc/interrups when you press power button. When that works then we can
> start thinking about adding wake support :)

I had CONFIG_ACPI_I2C_OPREGION=y but excluded CONFIG_MFD_AXP20X
based on \_SB.PIC0.I2C7.PMI1._STA returning 0 in acpidbg,

Device (PMI1)
{
Name (_ADR, Zero)  // _ADR: Address
Name (_HID, "INT33F4" /* XPOWER PMIC Controller */)  // _HID: 
Hardware ID
Name (_CID, "INT33F4" /* XPOWER PMIC Controller */)  // _CID: 
Compatible ID
Name (_DDN, "XPOWER PMIC Controller")  // _DDN: DOS Device Name

but \_SB.PIC0.I2C7.PMI1._STA returns 0xf

Device (PMI2)
{
Name (_ADR, Zero)  // _ADR: Address
Name (_HID, "INT33F5" /* TI PMIC Controller */)  // _HID: 
Hardware ID
Name (_CID, "INT33F5" /* TI PMIC Controller */)  // _CID: 
Compatible ID
Name (_DDN, "TI PMIC Controller")  // _DDN: DOS Device Name

So I tried CONFIG_MFD_AXP20X=y anyway, but as expected: no change.

Since TI doesn't even have a product page for the SND9039
(only a few references in TI support forum can be found),
I'm not sure what can be done.  So maybe a better short term
goal would be to get wakeup by LID working.

However, I still wonder why the power button can trigger
a thermal irq, is it related to the PMIC?  I couldn't
find out where the thermal irq is routed.


Thanks,
Johannes


Re: Cherryview wake up events

2016-09-19 Thread Johannes Stezenbach
On Mon, Sep 19, 2016 at 02:56:19PM +0300, Mika Westerberg wrote:
> On Mon, Sep 19, 2016 at 01:21:17PM +0200, Johannes Stezenbach wrote:
> > 
> > The LID causes a gpio irq:
> >  158:  2  0  0  0  chv-gpio   43 ACPI:Event
> > 
> > However, neither LID nor power button can wake up the
> > device from "echo freeze >/sys/power/state".  :-(
> 
> The cherryview pinctrl driver does not (yet) support wake up events. It
> currently just sets IRQCHIP_SKIP_SET_WAKE for the irqchip.

OK, but shouldn't the wakeup usually be handled by ACPI?
Clearly I don't understand this.  I mean on the non-ACPI
embedded ARM systems I'm used to I need to enable specific
irqs as wakeup sources, but on ACPI, isn't SCI the implicit
wakeup irq?  Probably I'm just totally confused, so let
me ask another way, below.

> I can make you a test patch which adds support for wakes for the pinctrl
> driver if you like to test it out. However, that will happen most likely
> near end of the week as I have other things right now.

That would be great!


I found in the DSDT:

Scope (_SB.GPO0)
{
Name (EVBF, Buffer (0x03) {})
CreateByteField (EVBF, Zero, EVST)
CreateByteField (EVBF, One, ELEN)
CreateByteField (EVBF, 0x02, ENVT)
Name (LIDZ, One)
Method (_E4E, 0, Serialized)  // _Exx: Edge-Triggered GPE
{
Name (_T_0, Zero)  // _T_x: Emitted by ASL Compiler
If (^^PCI0.I2C1.AVBL != One)
{
Return (Zero)
}

EVBF = ^^PCI0.I2C1.ENID /* \_SB_.PCI0.I2C1.ENID */
...
_T_0 = ENVT /* \_SB_.GPO0.ENVT */
...
ElseIf (_T_0 == 0xA9)
{
Notify (PWRB, 0x80) // Status Change
Break
}

and
Device (GPO0)
{
...
Method (_AEI, 0, NotSerialized)  // _AEI: ACPI Event Interrupts
{
Name (WBUF, ResourceTemplate ()
{
GpioInt (Edge, ActiveLow, ExclusiveAndWake, PullUp, 0x,
"\\_SB.GPO0", 0x00, ResourceConsumer, ,
)
{   // Pin list
0x004E
}
})
If (OSID == One)
{
Return (WBUF) /* \_SB_.GPO0._AEI.WBUF */
}
}

and OSID is a field in 
OperationRegion (GNVS, SystemMemory, 0x7A158000, 0x0362)
which is inside what /proc/iomem lists as "ACPI no-volatile storage".
OSID is read a lot in the DSDT but never written to.
But calling \_SB.GPO0._AEI in acpidbg returns a buffer of size 25.

Now my question is, is this pin 0x004E the same as this
in /proc/interrupts which fires on LID event?

 158:  2  0  0  0  chv-gpio   43 ACPI:Event



The FADT has
Control Method Power Button (V1) : 0
Control Method Sleep Button (V1) : 1

PWRBTN_EN in PM1 is set.  But PWRBTN press causes thermal irq.

No SCI (irq 9) is ever generated, except by writing to the
BIOS_RLS bit in SMI_EN register (IO port 0x430).

GPE block addresses in FADT are 0.  GPE0a_EN register (IO 0x428)
is set to 0x6000 (TCO_EN + PME_B0_EN, but none of the GPIO enables).

Any advice how to continue?


Thanks,
Johannes


Cherryview wake up events

2016-09-19 Thread Johannes Stezenbach
Hi,

Mika, I've been reading the thread about pinctrl-cherryview
interrupts, but I have some basic questions in understanding
the hardware and the relationship between ACPI and Linux drivers,
so I decided to start a new thread.
https://lkml.kernel.org/g/20160909085832.gk15...@lahna.fi.intel.com

I have one Asus E200HA (Atom x5-Z8300) where the power button
doesn't generate any ACPI events (no SCI), instead it causes
a Thermal Event irq:

 TRM:  3  3  3  4   Thermal event interrupts

[   51.825488] CPU0: Core temperature above threshold, cpu clock throttled 
(total events = 1)
[   51.826933] CPU1: Core temperature above threshold, cpu clock throttled 
(total events = 1)
[   51.826965] mce: [Hardware Error]: Machine check events logged
[   51.841180] mce: [Hardware Error]: Machine check events logged

(These events are logged only sometimes, usually a power button
press only increments the TRM count.)

I would like to understand how this is possible, when I boot
with apic=debug I can't see anything claiming vector 0xfa.

The LID causes a gpio irq:
 158:  2  0  0  0  chv-gpio   43 ACPI:Event

However, neither LID nor power button can wake up the
device from "echo freeze >/sys/power/state".  :-(

"grep . /sys/firmware/acpi/interrupts/*" shows only zeros.

I put the DSDT and some other tables at:
https://linuxtv.org/~js/e200ha/

During the last weeks I read what I could about the hardware
and ACPI, and poked at it with acpidbg, devmem, ioport
and in kernel source, but to no avail.

On Thu, Sep 15, 2016 at 06:52:10PM +0300, Mika Westerberg wrote:
> It turns out that for north and southwest communities, they can only
> generate GPIO interrupts for lower 8 interrupts (IntSel value). The upper
> part (8-15) can only generate GPEs (General Purpose Events).

I got the Atom Z8000 series datasheet from
http://www.intel.com/content/www/us/en/processors/atom/atom-technical-resources.html
and tried to find the source for this.  The closest I
could find is the GPIO_ROUT PMC register?
However, the datasheet doesn't tell about the other
interrupts not covered by GPIO_ROUT, if they are fixed
IRQ or SCI or "no effect".

I also don't get the mapping from intsel irq to IO-APIC pin
number.  And also not the mapping between the pin numbers used
on DSDT GpioInt to the pin numbers in pinctrl-cherryview.c.
Could you shed a light on this?  Or point out where I can
find information?

It seems to imply BIOS sets up IntSel.  I'm generally confused
about the responsibility of BIOS vs. drivers making use of the
information from DSDT, e.g. Device (GPO1) has a list of
GpioIo Connections, other devices like PMI2 use GpioInt
from GPO1.  My E200HA has the INT33F5 TI PMIC
Controller, which according to Windows driver strings
seems to be the SND9039.
Does it mean I need a PMIC driver that reads the _CRS and
configures the GPIO?

BTW, the datasheet talks about 4 seconds for power button
override, but it takes 10 seconds.  Maybe it means the
power button is connected to the TI PMIC, not to the
Cherryview SoC?

Another question is about the virtual GPIO device that exists
in hardware and is used by DSDT.  How does that work and
why does pinctrl-cherryview.c exclude it?

Sorry for so many questions, any info is appreciated,
and any suggestion what to try to get the thing to
wake up from freeze.

I was totally unfamiliar with ACPI until now, but I think
the DSDT has some nasty surprise in several _REG methods
that use OEM defined OperatingRegionIds to set some availabilty
flags that are tested in other methods.  So it means if the
Windows drivers aren't loaded, those methods won't do anything,
right? Does anyone have suggestions or even examples how to deal with this?


Thanks,
Johannes


Re: [PATCH 4.7 000/143] 4.7.3-stable review

2016-09-08 Thread Johannes Stezenbach
On Thu, Sep 08, 2016 at 08:52:32AM +0200, Greg Kroah-Hartman wrote:
> On Wed, Sep 07, 2016 at 04:59:37PM -0400, Levin, Alexander wrote:
> > Hey Greg,
> > 
> > For reference, I've generated a list of <=4.8-rc4 commits that look to me 
> > like stable material but are not in 4.7.3:
> > 
> > 422eac3f7deae34dbaffd08e03e27f37a5394a56 (v4.8-rc1) tpm_crb: fix mapping of 
> > the buffers
> > a36aa80f3cb2540fb1dbad6240852de4365a2e82 (v4.8-rc1) intel_th: Fix a 
> > deadlock in modprobing
> > 7a1a47ce35821b40f5b2ce46379ba14393bc3873 (v4.8-rc1) intel_th: pci: Add Kaby 
> > Lake PCH-H support
> > fa95986095e39205ea2fb5b5dafe271bca7eb8d1 (v4.8-rc1) drm/i915: Set legacy 
> > properties when using legacy gamma set IOCTL. (v2)
> > 78f4f7c2341f1cf510152ad494108850fec1ae39 (v4.8-rc1) ALSA: hda/realtek - 
> > ALC891 headset mode for Dell
> > 9b51fe3efe4c270005e34f55a97e5a84ad68e581 (v4.8-rc1) ALSA: hda - On-board 
> > speaker fixup on ACER Veriton
> > 7d9595d848cdff5c7939f68eec39e0c5d36a1d67 (v4.8-rc1) dm rq: fix the starting 
> > and stopping of blk-mq queues
> > 3b2c1710fac7fb278b760d1545e637cbb5ea5b5b (v4.8-rc2) drm/i915: Wait up to 
> > 3ms for the pcu to ack the cdclk change request on SKL
> > c518189567eaf42b2ec50a4d982484c8e38799f8 (v4.8-rc3) net: macb: Correct CAPS 
> > mask
> > 80788a0fbbdfbb125e3fd45a640cddb582160bc7 (v4.8-rc1) drm/i915/fbc: sanitize 
> > i915.enable_fbc during FBC init
> > 0a491b96aa59a7232f6c1a81414aa57fb8de8594 (v4.8-rc3) drm/i915/fbc: FBC 
> > causes display flicker when VT-d is enabled on Skylake
> > 3e103a65514c2947e53f3171b21255fbde8b60c6 (v4.8-rc4) ASoC: atmel_ssc_dai: 
> > Don't unconditionally reset SSC on stream startup
> > 1b856086813be9371929b6cc62045f9fd470f5a0 (v4.8-rc4) block: Fix race 
> > triggered by blk_set_queue_dying()
> > ae5b80d2b68eac945b124227dea34462118a6f01 (v4.8-rc4) drm/radeon: only apply 
> > the SS fractional workaround to RS[78]80
> > d9dc1702b297ec4a6bb9c0326a70641b322ba886 (v4.8-rc4) bcache: 
> > register_bcache(): call blkdev_put() when cache_alloc() fails
> > acc9cf8c66c66b2cbbdb4a375537edee72be64df (v4.8-rc4) bcache: RESERVE_PRIO is 
> > too small by one when prio_buckets() is a power of two.
> > 13f479b9df4e2bbf2d16e7e1b02f3f55f70e2455 (v4.8-rc4) drm/radeon: fix 
> > radeon_move_blit on 32bit systems
> > d77976c414ed7f521b9c79b2a9dde0147a3cf754 (v4.8-rc4) ARC: export kmap
> > c57653dc94d0db7bf63067433ceaa97bdcd0a312 (v4.8-rc4) ARC: export __udivdi3 
> > for modules
> > 6f00975c619064a18c23fd3aced325ae165a73b9 (v4.8-rc4) drm: Reject page_flip 
> > for !DRIVER_MODESET
> > e9e5e3fae8da7e237049e00e0bfc9e32fd808fe8 (v4.8-rc4) bdev: fix NULL pointer 
> > dereference
> > 6a33fa2b87513fee44cb8f0cd17b1acd6316bc6b (v4.8-rc4) irqchip/mips-gic: 
> > Cleanup chip and handler setup
> > 2564970a381651865364974ea414384b569cb9c0 (v4.8-rc4) irqchip/mips-gic: 
> > Implement activate op for device domain
> > c62fb260a86dde3df5b2905432caa0e9f6898434 (v4.8-rc4) IB/hfi1,IB/qib: Fix 
> > qp_stats sleep with rcu read lock held
> > a77ec83a57890240c546df00ca5df1cdeedb1cc3 (v4.8-rc4) vhost/scsi: fix reuse 
> > of &vq->iov[out] in response
> > c0082e985fdf77b02fc9e0dac3b58504dcf11b7a (v4.8-rc4) ubifs: Fix assertion in 
> > layout_in_gaps()
> > 17ce1eb0b64eb27d4f9180daae7495fa022c7b0d (v4.8-rc4) ubifs: Fix xattr 
> > generic handler usage
> > 27727df240c7cc84f2ba6047c6f18d5addfd25ef (v4.8-rc4) timekeeping: Avoid 
> > taking lock in NMI path with CONFIG_DEBUG_TIMEKEEPING
> > a4f8f6667f099036c88f231dcad4cf233652c824 (v4.8-rc4) timekeeping: Cap array 
> > access in timekeeping_debug
> > 2e63ad4bd5dd583871e6602f9d398b9322d358d9 (v4.8-rc4) x86/apic: Do not init 
> > irq remapping if ioapic is disabled
> > 9b47f77a680447e0132b2cf7fb82374e014bec1c (v4.8-rc4) nvme: Fix 
> > nvme_get/set_features() with a NULL result pointer
> > 4d70dca4eadf2f95abe389116ac02b8439c2d16c (v4.8-rc4) block: make sure a big 
> > bio is split into at most 256 bvecs
> > 9a035a40f7f3f6708b79224b86c5777a3334f7ea (v4.8-rc4) xenbus: don't look up 
> > transaction IDs for ordinary writes
> > 299f6230bc6d0ccd5f95bb0fb865d80a9c7d5ccc (v4.8-rc4) dm flakey: fix reads to 
> > be issued if drop_writes configured
> > b53e7d000d9e6e9fd2c6eb6b82d2783c67fd599e (v4.8-rc4) 
> > clocksource/drivers/sun4i: Clear interrupts after stopping timer in probe 
> > function
> > add1fa75101263ab4d74240f93000998d4325624 (v4.8-rc4) drm/atomic: Don't 
> > potentially reset color_mgmt_changed on successive property updates.
> > 
> 
> Thanks for these, I'll look at them after I get through the other
> "properly tagged" patches in my queue.  I also have a long list of stuff
> like this that I need to look at closer...

And another one:
b47820edd1634dc1208f9212b7ecfb4230610a23 ext4: avoid modifying checksum fields 
directly during checksum verification

Sorry fo the noise if you have it already, but there was
no repsonse to two pings in
https://lkml.kernel.org/r/20160901164016.gb25...@birch.djwong.org


Thanks,
Johannes


Re: 4.7.0-rc7 ext4 error in dx_probe

2016-08-17 Thread Johannes Stezenbach
On Fri, Aug 05, 2016 at 08:11:36PM +0200, Johannes Stezenbach wrote:
> On Fri, Aug 05, 2016 at 10:02:28AM -0700, Darrick J. Wong wrote:
> > 
> > When you're back on 4.7, can you apply this patch[1] to see if it fixes
> > the problem?  I speculate that the new parallel dir lookup code enables
> > multiple threads to be verifying the same directory block buffer at the
> > same time.
> > 
> > [1] 
> > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/fs/ext4/inode.c?id=b47820edd1634dc1208f9212b7ecfb4230610a23
> 
> I added the patch, rebuilt and rebooted.  It will take some time
> before I'll report back since the issue is so hard to reproduce.

FWIW, so far the issue didn't appear again after I applied
the patch to 4.7.0, and I stressed it a bit with repo syncs,
AOSP builds, rsync backups etc.

Johannes


4.7.0: RCU stall in nf_conntrack

2016-08-09 Thread Johannes Stezenbach
Hi,

I just experienced network hangup with 4.7.0, it happened shortly
after resume from hibernate:

[201988.443552] INFO: rcu_preempt detected stalls on CPUs/tasks:
[201988.443556] Tasks blocked on level-0 rcu_node (CPUs 0-3): P14563
[201988.443557] (detected by 3, t=18002 jiffies, g=7365154, c=7365153, 
q=15274)
[201988.443560] client_socket_t R  running task0 14563  1 0x
[201988.443563]  8800c427a900 e1b77832 880217603da0 
810bf66a
[201988.443565]  810bf5d1 8800c427a900 81e566c0 
880217603dd0
[201988.443567]  8119a3cf 8802177d80c0 81e566c0 
81f89ae0
[201988.443569] Call Trace:
[201988.443571][] sched_show_task+0xfa/0x160
[201988.443585]  [] ? sched_show_task+0x61/0x160
[201988.443587]  [] rcu_print_detail_task_stall_rnp+0x52/0x76
[201988.443590]  [] rcu_check_callbacks+0x866/0x9e0
[201988.443592]  [] update_process_times+0x39/0x60
[201988.443594]  [] tick_sched_handle.isra.5+0x21/0x60
[201988.443596]  [] tick_sched_timer+0x42/0x70
[201988.443598]  [] __hrtimer_run_queues+0x140/0x3c0
[201988.443599]  [] ? tick_sched_handle.isra.5+0x60/0x60
[201988.443601]  [] hrtimer_interrupt+0xb3/0x1c0
[201988.443603]  [] local_apic_timer_interrupt+0x36/0x60
[201988.443606]  [] smp_apic_timer_interrupt+0x3d/0x50
[201988.443607]  [] apic_timer_interrupt+0x8c/0xa0
[201988.443608][] ? 
__nf_conntrack_find_get+0x285/0x420
[201988.443611]  [] ? nf_conntrack_in+0x1d1/0x8d0
[201988.443612]  [] nf_conntrack_in+0x1d1/0x8d0
[201988.443615]  [] ipv4_conntrack_local+0x45/0x50
[201988.443616]  [] nf_iterate+0x62/0x80
[201988.443618]  [] nf_hook_slow+0xa0/0x110
[201988.443620]  [] ? nf_hook_slow+0x5/0x110
[201988.443622]  [] __ip_local_out+0xd8/0x120
[201988.443624]  [] ? ip_forward_options+0x1f0/0x1f0
[201988.443625]  [] ip_local_out+0x1c/0x70
[201988.443627]  [] ip_queue_xmit+0x18f/0x450
[201988.443628]  [] ? ip_queue_xmit+0x5/0x450
[201988.443630]  [] tcp_transmit_skb+0x48b/0x8e0
[201988.443632]  [] tcp_connect+0x629/0x830
[201988.443634]  [] ? secure_tcp_sequence_number+0x7f/0xe0
[201988.443636]  [] tcp_v4_connect+0x2b9/0x460
[201988.443638]  [] __inet_stream_connect+0xb2/0x310
[201988.443640]  [] ? preempt_count_sub+0xa1/0x100
[201988.443642]  [] ? lock_sock_nested+0x31/0x90
[201988.443644]  [] ? __local_bh_enable_ip+0x6f/0xd0
[201988.443646]  [] inet_stream_connect+0x38/0x50
[201988.443647]  [] SyS_connect+0x7b/0xf0
[201988.443649]  [] ? sock_alloc_file+0xa5/0x140
[201988.443651]  [] ? trace_hardirqs_on_thunk+0x1a/0x1c
[201988.443652]  [] entry_SYSCALL_64_fastpath+0x1f/0xbd
[201988.443654] client_socket_t R  running task0 14563  1 0x
[201988.443656]  8800c427a900 e1b77832 880217603da0 
810bf66a
[201988.443658]  810bf5d1 8800c427a900 81e566c0 
880217603dd0
[201988.443660]  8119a3cf 8802177d80c0 81e566c0 
81f89ae0
[201988.443662] Call Trace:
[201988.443663][] sched_show_task+0xfa/0x160
[201988.443665]  [] ? sched_show_task+0x61/0x160
[201988.443666]  [] rcu_print_detail_task_stall_rnp+0x52/0x76
[201988.443668]  [] rcu_check_callbacks+0x89f/0x9e0
[201988.443669]  [] update_process_times+0x39/0x60
[201988.443671]  [] tick_sched_handle.isra.5+0x21/0x60
[201988.443672]  [] tick_sched_timer+0x42/0x70
[201988.443674]  [] __hrtimer_run_queues+0x140/0x3c0
[201988.443675]  [] ? tick_sched_handle.isra.5+0x60/0x60
[201988.443677]  [] hrtimer_interrupt+0xb3/0x1c0
[201988.443679]  [] local_apic_timer_interrupt+0x36/0x60
[201988.443680]  [] smp_apic_timer_interrupt+0x3d/0x50
[201988.443682]  [] apic_timer_interrupt+0x8c/0xa0
[201988.443682][] ? 
__nf_conntrack_find_get+0x285/0x420
[201988.443685]  [] ? nf_conntrack_in+0x1d1/0x8d0
[201988.443686]  [] nf_conntrack_in+0x1d1/0x8d0
[201988.443688]  [] ipv4_conntrack_local+0x45/0x50
[201988.443689]  [] nf_iterate+0x62/0x80
[201988.443691]  [] nf_hook_slow+0xa0/0x110
[201988.443692]  [] ? nf_hook_slow+0x5/0x110
[201988.443694]  [] __ip_local_out+0xd8/0x120
[201988.443696]  [] ? ip_forward_options+0x1f0/0x1f0
[201988.443697]  [] ip_local_out+0x1c/0x70
[201988.443699]  [] ip_queue_xmit+0x18f/0x450
[201988.443700]  [] ? ip_queue_xmit+0x5/0x450
[201988.443702]  [] tcp_transmit_skb+0x48b/0x8e0
[201988.443703]  [] tcp_connect+0x629/0x830
[201988.443705]  [] ? secure_tcp_sequence_number+0x7f/0xe0
[201988.443706]  [] tcp_v4_connect+0x2b9/0x460
[201988.443708]  [] __inet_stream_connect+0xb2/0x310
[201988.443710]  [] ? preempt_count_sub+0xa1/0x100
[201988.443711]  [] ? lock_sock_nested+0x31/0x90
[201988.443713]  [] ? __local_bh_enable_ip+0x6f/0xd0
[201988.443715]  [] inet_stream_connect+0x38/0x50
[201988.443716]  [] SyS_connect+0x7b/0xf0
[201988.443718]  [] ? sock_alloc_file+0xa5/0x140
[201988.443719]  [] ? trace_hardirqs_on_thunk+0x1a/0x1c
[201988.443720]  [] entry_SYSCALL_64_fastpath+0x1f/0xbd
[202168.442569] INFO: rcu_preempt detected stalls on CPUs/tasks:
[202168.442572] Tasks 

Re: 4.7.0-rc7 ext4 error in dx_probe

2016-08-05 Thread Johannes Stezenbach
On Fri, Aug 05, 2016 at 10:02:28AM -0700, Darrick J. Wong wrote:
> On Fri, Aug 05, 2016 at 12:35:44PM +0200, Johannes Stezenbach wrote:
> > On Wed, Aug 03, 2016 at 05:50:26PM +0300, Török Edwin wrote:
> > > I have just encountered a similar problem after I've recently upgraded to 
> > > 4.7.0:
> > > [Wed Aug  3 11:08:57 2016] EXT4-fs error (device dm-1): dx_probe:740: 
> > > inode #13295: comm python: Directory index failed checksum
> > > [Wed Aug  3 11:08:57 2016] Aborting journal on device dm-1-8.
> > > [Wed Aug  3 11:08:57 2016] EXT4-fs (dm-1): Remounting filesystem read-only
> > > [Wed Aug  3 11:08:57 2016] EXT4-fs error (device dm-1): 
> > > ext4_journal_check_start:56: Detected aborted journal
> > 
> > It just happened again to me, this time hitting /usr/sbin/
> > on root fs.  Meanwhile I ran memtest86 7.0 for two nights,
> > it didn't find anything.  I'm using hibernate regularly
> > and I think so this only happened after a few hibernate/resume
> > cycles, but no idea if that means anything.
> > Now I'm back at 4.4.16 to see if it reproduces.
> 
> When you're back on 4.7, can you apply this patch[1] to see if it fixes
> the problem?  I speculate that the new parallel dir lookup code enables
> multiple threads to be verifying the same directory block buffer at the
> same time.
> 
> [1] 
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/fs/ext4/inode.c?id=b47820edd1634dc1208f9212b7ecfb4230610a23

I added the patch, rebuilt and rebooted.  It will take some time
before I'll report back since the issue is so hard to reproduce.

Thanks,
Johannes


Re: 4.7.0-rc7 ext4 error in dx_probe

2016-08-05 Thread Johannes Stezenbach
On Wed, Aug 03, 2016 at 05:50:26PM +0300, Török Edwin wrote:
> I have just encountered a similar problem after I've recently upgraded to 
> 4.7.0:
> [Wed Aug  3 11:08:57 2016] EXT4-fs error (device dm-1): dx_probe:740: inode 
> #13295: comm python: Directory index failed checksum
> [Wed Aug  3 11:08:57 2016] Aborting journal on device dm-1-8.
> [Wed Aug  3 11:08:57 2016] EXT4-fs (dm-1): Remounting filesystem read-only
> [Wed Aug  3 11:08:57 2016] EXT4-fs error (device dm-1): 
> ext4_journal_check_start:56: Detected aborted journal
> 
> I've rebooted in single-user mode, fsck fixed the filesystem, and rebooted, 
> filesystem is rw again now.
> 
> inode #13295 seems to be this and I can list it now:
> stat /usr/lib64/python3.4/site-packages
>   File: '/usr/lib64/python3.4/site-packages'
>   Size: 12288 Blocks: 24 IO Block: 4096   directory
> Device: fd01h/64769d  Inode: 13295   Links: 180
> Access: (0755/drwxr-xr-x)  Uid: (0/root)   Gid: (0/root)
> Access: 2016-05-09 11:29:44.056661988 +0300
> Modify: 2016-08-01 00:34:24.029779875 +0300
> Change: 2016-08-01 00:34:24.029779875 +0300
>  Birth: -
> 
> The filesystem was /, I only noticed it was readonly after several hours when 
> I tried to install something:
> /dev/mapper/vg--ssd-root on / type ext4 
> (rw,noatime,errors=remount-ro,data=ordered)
> 
> $ uname -a
> Linux bolt 4.7.0-gentoo-rr #1 SMP Thu Jul 28 11:28:56 EEST 2016 x86_64 AMD 
> FX(tm)-8350 Eight-Core Processor AuthenticAMD GNU/Linux
> 
> FWIW I've been using ext4 for years and this is the first time I see this 
> message.
> Prior to 4.7 I was on 4.6.1 -> 4.6.2 -> 4.6.3 -> 4.6.4.
> 
> The kernel is from gentoo-sources + a patch for enabling AMD LWP (I had that 
> patch since 4.6.3 and its not related to I/O).
> 
> If I see this message again what should I do to obtain more information to 
> trace down the root cause?

It just happened again to me, this time hitting /usr/sbin/
on root fs.  Meanwhile I ran memtest86 7.0 for two nights,
it didn't find anything.  I'm using hibernate regularly
and I think so this only happened after a few hibernate/resume
cycles, but no idea if that means anything.
Now I'm back at 4.4.16 to see if it reproduces.

Johannes


Re: 4.7.0-rc7 ext4 error in dx_probe

2016-07-27 Thread Johannes Stezenbach
On Mon, Jul 18, 2016 at 04:17:23PM +0200, Johannes Stezenbach wrote:
> On Mon, Jul 18, 2016 at 09:38:43AM -0400, Theodore Ts'o wrote:
> > On Mon, Jul 18, 2016 at 12:57:07PM +0200, Johannes Stezenbach wrote:
> > > 
> > > I'm running 4.7.0-rc7 with ext4 on lvm on dm-crypt on SSD
> > > and out of the blue on idle machine the following error
> > > message appeared:
> > > 
> > > [373851.683131] EXT4-fs (dm-3): error count since last fsck: 1
> > > [373851.683151] EXT4-fs (dm-3): initial error at time 1468438194: 
> > > dx_probe:740: inode 22288562
> > > [373851.683158] EXT4-fs (dm-3): last error at time 1468438194: 
> > > dx_probe:740: inode 22288562
> > > 
> > > inode 22288562 is a directory with ~800 small files in it,
> > > but AFAICT nothing was accessing it, no cron job running etc.
> > > No further error message was logged.  Accessing the directory
> > > and the files in it also gives no further errors.

FWIW, now with 4.7.0 and errors=remount-ro it just happened again
during git update (actually "repo sync -ld" of AOSP/cm
repository).  Again a directory with 321 small files.
ls on ro fs after the error listed the directory without problems.
Fsck fixed wrong inode and wrong free block count.
ls after fsck still listed the directory and "git status"
reported it as clean.

[72173.126740] EXT4-fs error (device dm-3): dx_probe:740: inode #12327817: comm 
git: Directory index failed checksum
[72173.131346] Aborting journal on device dm-3-8.
[72173.135884] EXT4-fs (dm-3): Remounting filesystem read-only

Since I upgraded the RAM from 4G to 8G not long ago I
suspect it could be the root of the issue, although
this RAM was taken from another machine (which I had
upgraded from 4G to 12G and now downgraded to 8G) where it
worked for ~2 years, also with AOSP stuff.  Sigh...


Johannes


Re: 4.7.0-rc7 ext4 error in dx_probe

2016-07-18 Thread Johannes Stezenbach
On Mon, Jul 18, 2016 at 09:38:43AM -0400, Theodore Ts'o wrote:
> On Mon, Jul 18, 2016 at 12:57:07PM +0200, Johannes Stezenbach wrote:
> > 
> > I'm running 4.7.0-rc7 with ext4 on lvm on dm-crypt on SSD
> > and out of the blue on idle machine the following error
> > message appeared:
> > 
> > [373851.683131] EXT4-fs (dm-3): error count since last fsck: 1
> > [373851.683151] EXT4-fs (dm-3): initial error at time 1468438194: 
> > dx_probe:740: inode 22288562
> > [373851.683158] EXT4-fs (dm-3): last error at time 1468438194: 
> > dx_probe:740: inode 22288562
> > 
> > inode 22288562 is a directory with ~800 small files in it,
> > but AFAICT nothing was accessing it, no cron job running etc.
> > No further error message was logged.  Accessing the directory
> > and the files in it also gives no further errors.
> 
> Yes, thes messages gets printed once a day in case there was a file
> system corruption detected earlier.  The problem is people
> unfortunately run with their file systems set to errors=continue,
> which I sometimes refer to as the "don't worry, be happy" option.  The
[snip]

I've not willingly done this, but I recently upgraded to a bigger
SSD and so created new file system, and the mount option for errors=
isn't specified so it uses the default from superblock, and
mkfs.ext4 has defaulted to "Errors behavior: Continue"
according to dumpe2fs -h.  I'm using Debian sid FWIW, just checked
the source of e2fsprogs-1.43.1 and found:

#define EXT2_ERRORS_DEFAULT EXT2_ERRORS_CONTINUE


During reboot after crash I saw the usual "Clearing orphaned inode"
messages scroll by, however they did not make it into systemd journal.
So I suspect if there were any other fsck errors during boot
they were lost, too, thanks to systemd-fsck.

Thanks for your detailed reply.


Johannes


4.7.0-rc7 ext4 error in dx_probe

2016-07-18 Thread Johannes Stezenbach
Hi,

I'm running 4.7.0-rc7 with ext4 on lvm on dm-crypt on SSD
and out of the blue on idle machine the following error
message appeared:

[373851.683131] EXT4-fs (dm-3): error count since last fsck: 1
[373851.683151] EXT4-fs (dm-3): initial error at time 1468438194: dx_probe:740: 
inode 22288562
[373851.683158] EXT4-fs (dm-3): last error at time 1468438194: dx_probe:740: 
inode 22288562

inode 22288562 is a directory with ~800 small files in it,
but AFAICT nothing was accessing it, no cron job running etc.
No further error message was logged.  Accessing the directory
and the files in it also gives no further errors.

Searching back in the log at date -d @1468438194 I found:

Jul 13 21:29:54 foo kernel: EXT4-fs error (device dm-3): dx_probe:740: inode 
#22288562: comm git: Directory index failed checksum


Time to run fsck?  Is it the consequence of a previous crash
(I had many recently)?


Johannes


Re: 4.6.2 frequent crashes under memory + IO pressure

2016-06-26 Thread Johannes Stezenbach
(adding back Cc:, just dropped it to send the logs)

On Mon, Jun 27, 2016 at 01:35:14AM +0900, Tetsuo Handa wrote:
> 
> It seems to me that GFP_NOIO allocation requests are depleting memory reserves
> because they are passing ALLOC_NO_WATERMARKS to get_page_from_freelist().
> But I'm not familiar with block layer / swap I/O operation. So, will you post
> to linux-mm ML for somebody else to help you?

Frankly I don't care that much about 4.6.y when 4.7 is fixed.
Or, maybe the root issue is not fixed but the new oom code
covers it.  Below I see both dm and kcryptd so there is no
surprise when using swap on lvm on dm-crypt triggers it.
Maybe it's not a new issue on 4.6 but just some random variation
that makes it trigger easier with my particular workload.

So, unless you would like to keep going at it I'd
like to put the issue at rest.

> kswapd0(766) 0x2201200
>  0x81167522 : get_page_from_freelist+0x0/0x82b [kernel]
>  0x81168127 : __alloc_pages_nodemask+0x3da/0x978 [kernel]
>  0x8119fb2a : new_slab+0xbc/0x3bb [kernel]
>  0x811a1acd : ___slab_alloc.constprop.22+0x2fb/0x37b [kernel]
>  0x81162a88 : mempool_alloc_slab+0x15/0x17 [kernel] (inexact)
>  0x810c502d : put_lock_stats.isra.9+0xe/0x20 [kernel] (inexact)
>  0x811a1ba4 : __slab_alloc.isra.17.constprop.21+0x57/0x8b [kernel] 
> (inexact)
>  0x811a1ba4 : __slab_alloc.isra.17.constprop.21+0x57/0x8b [kernel] 
> (inexact)
>  0x81162a88 : mempool_alloc_slab+0x15/0x17 [kernel] (inexact)
>  0x811a1c78 : kmem_cache_alloc+0xa0/0x1d6 [kernel] (inexact)
>  0x81162a88 : mempool_alloc_slab+0x15/0x17 [kernel] (inexact)
>  0x81162a88 : mempool_alloc_slab+0x15/0x17 [kernel] (inexact)
>  0x81162b7a : mempool_alloc+0x72/0x154 [kernel] (inexact)
>  0x810c6438 : __lock_acquire.isra.16+0x55e/0xb4c [kernel] (inexact)
>  0x8133fdc1 : bio_alloc_bioset+0xe8/0x1d7 [kernel] (inexact)
>  0x816342ea : alloc_tio+0x2d/0x47 [kernel] (inexact)
>  0x8163587e : __split_and_process_bio+0x310/0x3a3 [kernel] (inexact)
>  0x81635e15 : dm_make_request+0xb5/0xe2 [kernel] (inexact)
>  0x81347ae7 : generic_make_request+0xcc/0x180 [kernel] (inexact)
>  0x81347c98 : submit_bio+0xfd/0x145 [kernel] (inexact)
> 
> kswapd0(766) 0x2201200
>  0x81167522 : get_page_from_freelist+0x0/0x82b [kernel]
>  0x81168127 : __alloc_pages_nodemask+0x3da/0x978 [kernel]
>  0x8119fb2a : new_slab+0xbc/0x3bb [kernel]
>  0x811a1acd : ___slab_alloc.constprop.22+0x2fb/0x37b [kernel]
>  0x81162a88 : mempool_alloc_slab+0x15/0x17 [kernel] (inexact)
>  0x81640e29 : kcryptd_queue_crypt+0x63/0x68 [kernel] (inexact)
>  0x811a1ba4 : __slab_alloc.isra.17.constprop.21+0x57/0x8b [kernel] 
> (inexact)
>  0x811a1ba4 : __slab_alloc.isra.17.constprop.21+0x57/0x8b [kernel] 
> (inexact)
>  0x81162a88 : mempool_alloc_slab+0x15/0x17 [kernel] (inexact)
>  0x811a1c78 : kmem_cache_alloc+0xa0/0x1d6 [kernel] (inexact)
>  0x81162a88 : mempool_alloc_slab+0x15/0x17 [kernel] (inexact)
>  0x81162a88 : mempool_alloc_slab+0x15/0x17 [kernel] (inexact)
>  0x81162b7a : mempool_alloc+0x72/0x154 [kernel] (inexact)
>  0x8101f5ba : sched_clock+0x9/0xd [kernel] (inexact)
>  0x810ae420 : local_clock+0x20/0x22 [kernel] (inexact)
>  0x8133fdc1 : bio_alloc_bioset+0xe8/0x1d7 [kernel] (inexact)
>  0x811983d0 : end_swap_bio_write+0x0/0x6a [kernel] (inexact)
>  0x8119854b : get_swap_bio+0x25/0x6c [kernel] (inexact)
>  0x811983d0 : end_swap_bio_write+0x0/0x6a [kernel] (inexact)
>  0x811988ef : __swap_writepage+0x1a9/0x225 [kernel] (inexact)
> 
> > 
> > > # ~/systemtap.tmp/bin/stap -e 'global traces_bt[65536];
> > > probe begin { printf("Probe start!\n"); }
> > > function dump_if_new(mask:long) {
> > >   bt = backtrace();
> > >   if (traces_bt[bt]++ == 0) {
> > > printf("%s(%u) 0x%lx\n", execname(), pid(), mask);
> > > print_backtrace();
> > > printf("\n");
> > >   }
> > > }
> > > probe kernel.function("get_page_from_freelist") { if ($alloc_flags & 0x4) 
> > > dump_if_new($gfp_mask); }
> > > probe kernel.function("gfp_pfmemalloc_allowed").return { if ($return != 
> > > 0) dump_if_new($gfp_mask); }
> > > probe end { delete traces_bt; }'
> > ...
> > > # addr2line -i -e /usr/src/linux-4.6.2/vmlinux 0x811b9c82
> > > /usr/src/linux-4.6.2/mm/memory.c:1162
> > > /usr/src/linux-4.6.2/mm/memory.c:1241
> > > /usr/src/linux-4.6.2/mm/memory.c:1262
> > > /usr/src/linux-4.6.2/mm/memory.c:1283
> > 
> > I'm attaching both the stap output and the serial console log,
> > not sure what you're looking for with addr2line.  Let me know.
> 
> I just meant how to find location in source code from addresses.

I meant the log is so large I wouldn't know which
addresses would be interesting to look up.

Thanks,
Johannes


Re: 4.6.2 frequent crashes under memory + IO pressure

2016-06-25 Thread Johannes Stezenbach
On Sun, Jun 26, 2016 at 02:04:40AM +0900, Tetsuo Handa wrote:
> It seems to me that somebody is using ALLOC_NO_WATERMARKS (with possibly
> __GFP_NOWARN), but I don't know how to identify such callers. Maybe print
> backtrace from __alloc_pages_slowpath() when ALLOC_NO_WATERMARKS is used?

Wouldn't this create too much output for slow serial console?
Or is this case supposed to be triggered rarely?

This crash testing is pretty painful but I can try it tomorrow
if there is no better idea.

Johannes


Re: 4.6.2 frequent crashes under memory + IO pressure

2016-06-25 Thread Johannes Stezenbach
On Thu, Jun 23, 2016 at 08:26:35PM +0900, Tetsuo Handa wrote:
> 
> Since you think you saw OOM messages with the older kernels, I assume that 
> the OOM
> killer was invoked on your 4.6.2 kernel. The OOM reaper in Linux 4.6 and 
> Linux 4.7
> will not help if the OOM killed process was between down_write(&mm->mmap_sem) 
> and
> up_write(&mm->mmap_sem).
> 
> I was not able to confirm whether the OOM killed process (I guess it was java)
> was holding mm->mmap_sem for write, for /proc/sys/kernel/hung_task_warnings
> dropped to 0 before traces of java threads are printed or console became
> unusable due to the "delayed: kcryptd_crypt, ..." line. Anyway, I think that
> kmallocwd will report it.
> 
> > > It is sad that we haven't merged kmallocwd which will report
> > > which memory allocations are stalling
> > >  ( 
> > > http://lkml.kernel.org/r/1462630604-23410-1-git-send-email-penguin-ker...@i-love.sakura.ne.jp
> > >  ).
> > 
> > Would you like me to try it?  It wouldn't prevent the hang, though,
> > just print better debug ouptut to serial console, right?
> > Or would it OOM kill some process?
> 
> Yes, but for bisection purpose, please try commit 78ebc2f7146156f4 without
> applying kmallocwd. If that commit helps avoiding flood of the allocation
> failure warnings, we can consider backporting it. If that commit does not
> help, I think you are reporting a new location which we should not use
> memory reserves.
> 
> kmallocwd will not OOM kill some process. kmallocwd will not prevent the hang.
> kmallocwd just prints information of threads which are stalling inside memory
> allocation request.

First I tried today's git, linux-4.7-rc4-187-g086e3eb, and
the good news is that the oom killer seems to work very
well and reliably killed the offending task (java).
It happened a few times, the AOSP build broke and I restarted
it until it completed.  E.g.:

[ 2083.604374] Purging GPU memory, 0 pages freed, 4508 pages still pinned.
[ 2083.611000] 96 and 0 pages still available in the bound and unbound GPU page 
lists.
[ 2083.618815] make invoked oom-killer: 
gfp_mask=0x27000c0(GFP_KERNEL_ACCOUNT|__GFP_NOTRACK), order=2, oom_score_adj=0
[ 2083.629257] make cpuset=/ mems_allowed=0
...
[ 2084.688753] Out of memory: Kill process 10431 (java) score 378 or sacrifice 
child
[ 2084.696593] Killed process 10431 (java) total-vm:5200964kB, 
anon-rss:2521764kB, file-rss:0kB, shmem-rss:0kB
[ 2084.938058] oom_reaper: reaped process 10431 (java), now anon-rss:0kB, 
file-rss:8kB, shmem-rss:0kB

Next I tried 4.6.2 with 78ebc2f7146156f4, then with kmallocwd (needed one 
manual fixup),
then both patches.  It still livelocked in all cases, the log spew looked
a bit different with 78ebc2f7146156f4 applied but still continued
endlessly.  kmallocwd alone didn't trigger, with both patches
applied kmallocwd triggered but:

[  363.815595] MemAlloc-Info: stalling=33 dying=0 exiting=42 victim=0 
oom_count=0
[  363.815601] MemAlloc: kworker/0:0(4) flags=0x4208860 switches=212 seq=1 
gfp=0x26012c0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_NOTRACK) order=0 
delay=17984
** 1402 printk messages dropped ** [  363.818816]  [] 
__do_page_cache_readahead+0x144/0x29d
** 501 printk messages dropped **

I'll zip up the logs and send them off-list.


Thanks,
Johannes


Re: 4.6.2 frequent crashes under memory + IO pressure

2016-06-23 Thread Johannes Stezenbach
On Tue, Jun 21, 2016 at 08:47:51PM +0900, Tetsuo Handa wrote:
> Johannes Stezenbach wrote:
> > 
> > a man's got to have a hobby, thus I'm running Android AOSP
> > builds on my home PC which has 4GB of RAM, 4GB swap.
> > Apparently it is not really adequate for the job but used to
> > work with a 4.4.10 kernel.  Now I upgraded to 4.6.2
> > and it crashes usually within 30mins during compilation.
> 
> Such reproducer is welcomed.
> You might be hitting OOM livelock using innocent workload.
> 
> > The crash is a hard hang, mouse doesn't move, no reaction
> > to keyboard, nothing in logs (systemd journal) after reboot.
> 
> Yes, it seems to me that your system is OOM livelocked.

I got from my crash log that X is hanging in
i915_gem_object_get_pages_gtt, and network is dead
due to order 0 allocation errors causing a series of
"ath9k_htc: RX memory allocation error", which is
what makes the issue so unpleasant.

The particular command which triggers it seems to be
Jill from the Android Java toolchain
(http://tools.android.com/tech-docs/jackandjill),
which runs as "java -Xmx3500m -jar $(JILL_JAR)", i.e.
potentially eating all my available RAM when linking
the Android framework.

Meanwhile I found some RAM and linux-4.6.2 runs stable
with 8GB for this workload.  The build time (for the
partial AOSP rebuild that fairly reliably triggered the hangup)
dropped from ~20min to ~17min (so it wasn't trashing too
badly), swap usage dropped from ~50% (of 4GB) to <5%.

> It is sad that we haven't merged kmallocwd which will report
> which memory allocations are stalling
>  ( 
> http://lkml.kernel.org/r/1462630604-23410-1-git-send-email-penguin-ker...@i-love.sakura.ne.jp
>  ).

Would you like me to try it?  It wouldn't prevent the hang, though,
just print better debug ouptut to serial console, right?
Or would it OOM kill some process?

> > Then I tried 4.5.7, it seems to be stable so far.
> > 
> > I'm using dm-crypt + lvm + ext4 (swap also in lvm).
> > 
> > Now I hooked up a laptop to the serial port and captured
> > some logs of the crash which seems to be repeating
> > 
> > [ 2240.842567] swapper/3: page allocation failure: order:0, 
> > mode:0x2200020(GFP_NOWAIT|__GFP_HIGH|__GFP_NOTRACK)
> > or
> > [ 2241.167986] SLUB: Unable to allocate memory on node -1, 
> > gfp=0x2080020(GFP_ATOMIC)
> > 
> > over and over.  Based on the backtraces in the log I decided
> > to hot-unplug USB devices, and twice the kernel came
> > back to live, but on the 3rd crash it was dead for good.
> 
> The values
> 
>   DMA free:12kB min:32kB
>   DMA32 free:2268kB min:6724kB
>   Normal free:84kB min:928kB 
> 
> suggest that memory reserves are spent for pointless purpose. Maybe your 
> system is
> falling into situation which was mitigated by commit 78ebc2f7146156f4 
> ("mm,writeback:
> don't use memory reserves for wb_start_writeback"). Thus, applying that 
> commit to
> your 4.6.2 kernel might help avoiding flood of these allocation failure 
> messages.

I could try.  Could you let me know if booting with mem=4G
is equivalent, or do I need to use memmap= or physically remove
the RAM (which is not so easy since the CPU fan is in the way).

> > Before I pressed the reset button I used SysRq-W.  At the bottom
> > is a "BUG: workqueue lockup", it could be the result of
> > the log spew on serial console taking so long but it looks
> > like some IO is never completing.
> 
> But even after you apply that commit, I guess you will still see silent hang 
> up
> because the page allocator would think there is still reclaimable memory. So, 
> is
> it possible to also try current linux.git kernels? I'd like to know whether
> "OOM detection rework" (which went to 4.7) helps giving up reclaiming and
> invoking the OOM killer with your workload.
> 
> Maybe __GFP_FS allocations start invoking the OOM killer. But maybe __GFP_FS
> allocations still remain stuck waiting for !__GFP_FS allocations whereas 
> !__GFP_FS
> allocations gives up without invoking the OOM killer (i.e. effectively no 
> "give up").

I could also try.  Same question about mem= though.

What is your opinion about older kernels (4.4, 4.5) working?
I think I've seen some OOM messages with the older kernels,
Jill was killed and I restarted the build to complete it.
A full bisect would take more than a day, I don't think
I have the time for it.
Since I use dm-crypt + lvm, should we add more Cc or do
you think it is an mm issue?


> > Below I'm pasting some log snippets, let me know if you like
> > it so much you want more of it ;-/  The total log is about 1.7MB.
> 
> Yes, I'd like to browse it. Could you send it to me?

Did you get any additional insights from it?


Thanks,
Johannes


4.6.2 frequent crashes under memory + IO pressure

2016-06-16 Thread Johannes Stezenbach
Hi,

a man's got to have a hobby, thus I'm running Android AOSP
builds on my home PC which has 4GB of RAM, 4GB swap.
Apparently it is not really adequate for the job but used to
work with a 4.4.10 kernel.  Now I upgraded to 4.6.2
and it crashes usually within 30mins during compilation.
The crash is a hard hang, mouse doesn't move, no reaction
to keyboard, nothing in logs (systemd journal) after reboot.

Then I tried 4.5.7, it seems to be stable so far.

I'm using dm-crypt + lvm + ext4 (swap also in lvm).

Now I hooked up a laptop to the serial port and captured
some logs of the crash which seems to be repeating

[ 2240.842567] swapper/3: page allocation failure: order:0, 
mode:0x2200020(GFP_NOWAIT|__GFP_HIGH|__GFP_NOTRACK)
or
[ 2241.167986] SLUB: Unable to allocate memory on node -1, 
gfp=0x2080020(GFP_ATOMIC)

over and over.  Based on the backtraces in the log I decided
to hot-unplug USB devices, and twice the kernel came
back to live, but on the 3rd crash it was dead for good.
Before I pressed the reset button I used SysRq-W.  At the bottom
is a "BUG: workqueue lockup", it could be the result of
the log spew on serial console taking so long but it looks
like some IO is never completing.

Below I'm pasting some log snippets, let me know if you like
it so much you want more of it ;-/  The total log is about 1.7MB.


Thanks,
Johannes


[ 2240.837431] warn_alloc_failed: 13 callbacks suppressed
[ 2240.842567] swapper/3: page allocation failure: order:0, 
mode:0x2200020(GFP_NOWAIT|__GFP_HIGH|__GFP_NOTRACK)
[ 2240.852384] CPU: 3 PID: 0 Comm: swapper/3 Not tainted 4.6.2 #2
[ 2240.858215] Hardware name: System manufacturer System Product Name/P8H77-V, 
BIOS 1905 10/27/2014
[ 2240.866985]  0086 8d325b5c895ad90b 88011b603a90 
81368f0c
[ 2240.874437]    88011b603b30 
811659de
[ 2240.881907]  88011b603b40 02200021 88011b603b18 
81f58240
[ 2240.889396] Call Trace:
[ 2240.891839][] dump_stack+0x85/0xbe
[ 2240.897611]  [] warn_alloc_failed+0x134/0x15c
[ 2240.903531]  [] __alloc_pages_nodemask+0x7bd/0x978
[ 2240.909884]  [] new_slab+0x129/0x3bb
[ 2240.915030]  [] ___slab_alloc.constprop.22+0x2fb/0x37b
[ 2240.921730]  [] ? __alloc_skb+0x55/0x1b4
[ 2240.927224]  [] ? skb_release_data+0xc0/0xd0
[ 2240.933046]  [] ? kfree+0x1c0/0x216
[ 2240.938089]  [] __slab_alloc.isra.17.constprop.21+0x57/0x8b
[ 2240.945214]  [] ? 
__slab_alloc.isra.17.constprop.21+0x57/0x8b
[ 2240.952520]  [] ? __alloc_skb+0x55/0x1b4
[ 2240.957997]  [] kmem_cache_alloc+0xa0/0x1d6
[ 2240.963734]  [] ? __alloc_skb+0x55/0x1b4
[ 2240.969210]  [] __alloc_skb+0x55/0x1b4
[ 2240.974524]  [] ath9k_hif_usb_reg_in_cb+0xd4/0x181 
[ath9k_htc]
[ 2240.981925]  [] __usb_hcd_giveback_urb+0xa6/0x10b
[ 2240.988215]  [] usb_giveback_urb_bh+0x9a/0xe4
[ 2240.994134]  [] tasklet_hi_action+0x10c/0x11b
[ 2241.63]  [] __do_softirq+0x182/0x377
[ 2241.005548]  [] irq_exit+0x54/0xa8
[ 2241.010521]  [] do_IRQ+0xc7/0xdf
[ 2241.015321]  [] common_interrupt+0x8c/0x8c
[ 2241.020981][] ? cpuidle_enter_state+0x1ae/0x251
[ 2241.027888]  [] cpuidle_enter+0x17/0x19
[ 2241.033280]  [] call_cpuidle+0x44/0x46
[ 2241.038600]  [] cpu_startup_entry+0x2a7/0x378
[ 2241.044524]  [] start_secondary+0x17c/0x192
[ 2241.050265] Mem-Info:
[ 2241.052543] active_anon:654174 inactive_anon:208849 isolated_anon:64
[ 2241.052543]  active_file:4782 inactive_file:3878 isolated_file:0
[ 2241.052543]  unevictable:1156 dirty:8 writeback:28052 unstable:0
[ 2241.052543]  slab_reclaimable:13827 slab_unreclaimable:25768
[ 2241.052543]  mapped:6794 shmem:3939 pagetables:5299 bounce:0
[ 2241.052543]  free:424 free_pcp:39 free_cma:0
[ 2241.086414] DMA free:12kB min:32kB low:44kB high:56kB active_anon:28kB 
inactive_anon:84kB active_file:68kB inactive_file:40kB unevictable:124kB 
isolated(anon):0kB isolated(file):0kB present:15984kB managed:15900kB 
mlocked:124kB dirty:0kB writeback:0kB mapped:228kB shmem:36kB 
slab_reclaimable:552kB slab_unreclaimable:14656kB kernel_stack:0kB 
pagetables:0kB unstable:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB 
writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[ 2241.128265] lowmem_reserve[]: 0 3156 3592 3592
[ 2241.132792] DMA32 free:2120kB min:6724kB low:9956kB high:13188kB 
active_anon:2414116kB inactive_anon:629228kB active_file:15184kB 
inactive_file:13336kB unevictable:3624kB isolated(anon):256kB 
isolated(file):0kB present:3334492kB managed:3243420kB mlocked:3624kB 
dirty:24kB writeback:104760kB mapped:21988kB shmem:13936kB 
slab_reclaimable:46356kB slab_unreclaimable:74196kB kernel_stack:4144kB 
pagetables:17708kB unstable:0kB bounce:0kB free_pcp:0kB local_pcp:0kB 
free_cma:0kB writeback_tmp:0kB pages_scanned:92 all_unreclaimable? no
[ 2241.167769] kworker/u8:3: page allocation failure: order:0, 
mode:0x2200020(GFP_NOWAIT|__GFP_HIGH|__GFP_NOTRACK)
[ 2241.167771] CPU: 2 PID: 1470 Comm: kworker/u8:3 Not tainted 4.6.2 #2
[ 2241.167772] Hardware name: System manufactur

uas: order 7 page allocation failure in init_tag_map()

2016-04-23 Thread Johannes Stezenbach
Hi,

I bought a new backup disk which turned out to be UAS capable,
but when I plugged it in I got an order 7 page allocation failure.
My hunch is that the .can_queue = 65536 in drivers/usb/storage/uas.c
is much too large.  Maybe 256 would be a pratical value that matches
the capabilities of existing hardware?


[1859683.261465] usb 4-2: new SuperSpeed USB device number 8 using xhci_hcd
[1859683.281986] scsi host18: uas
[1859683.282003] kworker/0:2: page allocation failure: order:7, mode:0x208c020
[1859683.282008] CPU: 0 PID: 6888 Comm: kworker/0:2 Not tainted 4.4.6 #1
[1859683.282011] Hardware name: System manufacturer System Product 
Name/P8H77-V, BIOS 1905 10/27/2014
[1859683.282017] Workqueue: usb_hub_wq hub_event
[1859683.282021]  0286 d38f5999 8800751674d0 
813527de
[1859683.282026]   0208c020 880075167570 
81157c56
[1859683.282031]  880075167580 880075167508 81f43840 
00f438b8
[1859683.282036] Call Trace:
[1859683.282045]  [] dump_stack+0x85/0xbe
[1859683.282050]  [] warn_alloc_failed+0x12c/0x156
[1859683.282055]  [] __alloc_pages_nodemask+0x73a/0x8f1
[1859683.282060]  [] ? dev_vprintk_emit+0x1cb/0x1f1
[1859683.282065]  [] alloc_kmem_pages+0x22/0x8a
[1859683.282069]  [] kmalloc_order+0x18/0x46
[1859683.282072]  [] kmalloc_order_trace+0x21/0xe9
[1859683.282077]  [] __kmalloc+0x38/0x22f
[1859683.282081]  [] ? __blk_queue_init_tags+0x2f/0x73
[1859683.282085]  [] init_tag_map+0x54/0xa3
[1859683.282088]  [] __blk_queue_init_tags+0x45/0x73
[1859683.282092]  [] blk_init_tags+0x14/0x16
[1859683.282096]  [] scsi_add_host_with_dma+0xc8/0x2a0
[1859683.282102]  [] uas_probe+0x3aa/0x420 [uas]
[1859683.282107]  [] usb_probe_interface+0x1a6/0x22d
[1859683.282112]  [] driver_probe_device+0x173/0x3a6
[1859683.282116]  [] __device_attach_driver+0x71/0x78
[1859683.282120]  [] ? driver_allows_async_probing+0x31/0x31
[1859683.282124]  [] bus_for_each_drv+0x8a/0xad
[1859683.282128]  [] __device_attach+0xba/0x14f
[1859683.282132]  [] device_initial_probe+0x13/0x15
[1859683.282136]  [] bus_probe_device+0x33/0x9e
[1859683.282140]  [] device_add+0x2e4/0x56e
[1859683.282144]  [] usb_set_configuration+0x689/0x6d9
[1859683.282148]  [] ? debug_smp_processor_id+0x17/0x19
[1859683.282152]  [] generic_probe+0x43/0x73
[1859683.282156]  [] usb_probe_device+0x53/0x66
[1859683.282159]  [] driver_probe_device+0x173/0x3a6
[1859683.282163]  [] __device_attach_driver+0x71/0x78
[1859683.282167]  [] ? driver_allows_async_probing+0x31/0x31
[1859683.282171]  [] bus_for_each_drv+0x8a/0xad
[1859683.282175]  [] __device_attach+0xba/0x14f
[1859683.282179]  [] device_initial_probe+0x13/0x15
[1859683.282183]  [] bus_probe_device+0x33/0x9e
[1859683.282186]  [] device_add+0x2e4/0x56e
[1859683.282191]  [] usb_new_device+0x241/0x38a
[1859683.282194]  [] hub_event+0xcb9/0x10f2
[1859683.282201]  [] process_one_work+0x27f/0x4d7
[1859683.282206]  [] ? put_lock_stats.isra.9+0xe/0x20
[1859683.282209]  [] worker_thread+0x273/0x35b
[1859683.282214]  [] ? rescuer_thread+0x2a7/0x2a7
[1859683.282217]  [] kthread+0xff/0x107
[1859683.28]  [] ? kthread_create_on_node+0x1ea/0x1ea
[1859683.282228]  [] ret_from_fork+0x3f/0x70
[1859683.282231]  [] ? kthread_create_on_node+0x1ea/0x1ea
[1859683.282234] Mem-Info:
[1859683.282241] active_anon:21278 inactive_anon:69854 isolated_anon:0
  active_file:212300 inactive_file:194346 isolated_file:0
  unevictable:2018 dirty:87 writeback:0 unstable:0
  slab_reclaimable:127644 slab_unreclaimable:12137
  mapped:11526 shmem:13394 pagetables:5007 bounce:0
  free:270678 free_pcp:1027 free_cma:0
[1859683.282252] DMA free:14412kB min:32kB low:40kB high:48kB active_anon:180kB 
inactive_anon:468kB active_file:268kB inactive_file:92kB unevictable:0kB 
isolated(anon):0kB isolated(file):0kB present:15984kB managed:15900kB 
mlocked:0kB dirty:4kB writeback:0kB mapped:172kB shmem:328kB 
slab_reclaimable:208kB slab_unreclaimable:92kB kernel_stack:0kB pagetables:56kB 
unstable:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB 
writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[1859683.282255] lowmem_reserve[]: 0 3162 3597 3597
[1859683.282267] DMA32 free:904468kB min:6728kB low:8408kB high:10092kB 
active_anon:66188kB inactive_anon:237164kB active_file:803244kB 
inactive_file:704168kB unevictable:7024kB isolated(anon):0kB isolated(file):0kB 
present:3334492kB managed:3243208kB mlocked:7024kB dirty:280kB writeback:0kB 
mapped:37116kB shmem:40212kB slab_reclaimable:435236kB 
slab_unreclaimable:37848kB kernel_stack:3968kB pagetables:16696kB unstable:0kB 
bounce:0kB free_pcp:2008kB local_pcp:632kB free_cma:0kB writeback_tmp:0kB 
pages_scanned:0 all_unreclaimable? no
[1859683.282270] lowmem_reserve[]: 0 0 435 435
[1859683.282281] Normal free:163832kB min:924kB low:1152kB high:1384kB 
active_anon:18744kB inactive_anon:41784kB active_file:45688kB 
inactive_file:73124kB unevi

Re: Kernel docs: muddying the waters a bit

2016-03-07 Thread Johannes Stezenbach
On Mon, Mar 07, 2016 at 12:29:08AM +0100, Johannes Stezenbach wrote:
> On Sat, Mar 05, 2016 at 11:29:37PM -0300, Mauro Carvalho Chehab wrote:
> > 
> > I converted one of the big tables to CSV. At least now it recognized
> > it as a table. Yet, the table was very badly formated:
> > 
> > https://mchehab.fedorapeople.org/media-kabi-docs-test/rst_tests/packed-rgb.html
> > 
> > This is how this table should look like:
> > https://linuxtv.org/downloads/v4l-dvb-apis/packed-rgb.html
> > 
> > Also, as this table has merged cells at the legend. I've no idea how
> > to tell sphinx to do that on csv format.
> > 
> > The RST files are on this git tree:
> > https://git.linuxtv.org/mchehab/v4l2-docs-poc.git/
> 
> Yeah, seems it can't do merged cells in csv.  Attached patch converts it
> back to grid table format and fixes the table definition.
> The html output looks usable, but clearly it is no fun to
> work with tables in Sphinx.
> 
> Sphinx' latex writer can't handle nested tables, though.
> Python's docutils rst2latex can, but that doesn't help here.
> rst2pdf also supports it.  But I have doubts such a large
> table would render OK in pdf without using landscape orientation.
> I have not tried because I used python3-sphinx but rst2pdf
> is only availble for Python2 in Debian so it does not integrate
> with Sphinx.

Just a quick idea:
Perhaps one alternative would be to use Graphviz to render
the problematic tables, it supports a HTML-like syntax
and can be embedded in Spinx documents:

http://www.sphinx-doc.org/en/stable/ext/graphviz.html
http://www.graphviz.org/content/node-shapes#html
http://stackoverflow.com/questions/13890568/graphviz-html-nested-tables


Johannes


Re: Kernel docs: muddying the waters a bit

2016-03-06 Thread Johannes Stezenbach
On Sat, Mar 05, 2016 at 11:29:37PM -0300, Mauro Carvalho Chehab wrote:
> 
> I converted one of the big tables to CSV. At least now it recognized
> it as a table. Yet, the table was very badly formated:
>   
> https://mchehab.fedorapeople.org/media-kabi-docs-test/rst_tests/packed-rgb.html
> 
> This is how this table should look like:
>   https://linuxtv.org/downloads/v4l-dvb-apis/packed-rgb.html
> 
> Also, as this table has merged cells at the legend. I've no idea how
> to tell sphinx to do that on csv format.
> 
> The RST files are on this git tree:
>   https://git.linuxtv.org/mchehab/v4l2-docs-poc.git/

Yeah, seems it can't do merged cells in csv.  Attached patch converts it
back to grid table format and fixes the table definition.
The html output looks usable, but clearly it is no fun to
work with tables in Sphinx.

Sphinx' latex writer can't handle nested tables, though.
Python's docutils rst2latex can, but that doesn't help here.
rst2pdf also supports it.  But I have doubts such a large
table would render OK in pdf without using landscape orientation.
I have not tried because I used python3-sphinx but rst2pdf
is only availble for Python2 in Debian so it does not integrate
with Sphinx.


Johannes
>From 61674b398e778bd5ff644ffd493d5ff1cfaca0ef Mon Sep 17 00:00:00 2001
From: Johannes Stezenbach 
Date: Sun, 6 Mar 2016 23:55:19 +0100
Subject: [PATCH] some progress for html output

---
 _static/borderless.css |  3 --
 _static/v4l2tables.css |  9 +
 _templates/layout.html |  9 +
 packed-rgb.rst | 88 +-
 pixfmt-yuyv.rst|  2 +-
 v4l-table-within-table.rst | 72 +++--
 6 files changed, 105 insertions(+), 78 deletions(-)
 delete mode 100644 _static/borderless.css
 create mode 100644 _static/v4l2tables.css

diff --git a/_static/borderless.css b/_static/borderless.css
deleted file mode 100644
index bfd4b01..000
--- a/_static/borderless.css
+++ /dev/null
@@ -1,3 +0,0 @@
-table#table-borderless {
-border: 1px solid black;
-}
diff --git a/_static/v4l2tables.css b/_static/v4l2tables.css
new file mode 100644
index 000..c045e45
--- /dev/null
+++ b/_static/v4l2tables.css
@@ -0,0 +1,9 @@
+table.noborder {
+border: 1px solid black;
+background: white;
+white-space: nowrap;
+}
+
+table.noborder td, table.noborder th {
+padding: 0px;
+}
diff --git a/_templates/layout.html b/_templates/layout.html
index b6bf12b..637332d 100644
--- a/_templates/layout.html
+++ b/_templates/layout.html
@@ -1,9 +1,2 @@
 {% extends "!layout.html" %}
-{% block tables %}
-
-table#table-borderless {
-border: 1px solid black;
-}
-
-{{ super() }}
-{% endblock %}
+{% set css_files = css_files + ["_static/v4l2tables.css"] %}
diff --git a/packed-rgb.rst b/packed-rgb.rst
index 352b91c..b4fcf3e 100644
--- a/packed-rgb.rst
+++ b/packed-rgb.rst
@@ -9,25 +9,46 @@ graphics frame buffers. They occupy 8, 16, 24 or 32 bits per pixel.
 These are all packed-pixel formats, meaning all the data for a pixel lie
 next to each other in memory.
 
-.. csv-table:: Table: Packed RGB Image Formats
-  :header: Identifier,Code, ,Byte 0 in memory,Byte 1,Byte 2,Byte 3
+.. table:: Packed RGB Image Formats
+   :class: noborder
 
-  ``V4L2_PIX_FMT_RGB332``,'RGB1',,r\ :sub:`2`,r\ :sub:`1`,r\ :sub:`0`,g\ :sub:`2`,g\ :sub:`1`,g\ :sub:`0`,b\ :sub:`1`,b\ :sub:`0`
-  ``V4L2_PIX_FMT_ARGB444``,'AR12',,g\ :sub:`3`,g\ :sub:`2`,g\ :sub:`1`,g\ :sub:`0`,b\ :sub:`3`,b\ :sub:`2`,b\ :sub:`1`,b\ :sub:`0`,,a\ :sub:`3`,a\ :sub:`2`,a\ :sub:`1`,a\ :sub:`0`,r\ :sub:`3`,r\ :sub:`2`,r\ :sub:`1`,r\ :sub:`0`
-  ``V4L2_PIX_FMT_XRGB444``,'XR12',,g\ :sub:`3`,g\ :sub:`2`,g\ :sub:`1`,g\ :sub:`0`,b\ :sub:`3`,b\ :sub:`2`,b\ :sub:`1`,b\ :sub:`0`,,-,-,-,-,r\ :sub:`3`,r\ :sub:`2`,r\ :sub:`1`,r\ :sub:`0`
-  ``V4L2_PIX_FMT_ARGB555``,'AR15',,g\ :sub:`2`,g\ :sub:`1`,g\ :sub:`0`,b\ :sub:`4`,b\ :sub:`3`,b\ :sub:`2`,b\ :sub:`1`,b\ :sub:`0`,,a,r\ :sub:`4`,r\ :sub:`3`,r\ :sub:`2`,r\ :sub:`1`,r\ :sub:`0`,g\ :sub:`4`,g\ :sub:`3`
-  ``V4L2_PIX_FMT_XRGB555``,'XR15',,g\ :sub:`2`,g\ :sub:`1`,g\ :sub:`0`,b\ :sub:`4`,b\ :sub:`3`,b\ :sub:`2`,b\ :sub:`1`,b\ :sub:`0`,,-,r\ :sub:`4`,r\ :sub:`3`,r\ :sub:`2`,r\ :sub:`1`,r\ :sub:`0`,g\ :sub:`4`,g\ :sub:`3`
-  ``V4L2_PIX_FMT_RGB565``,'RGBP',,g\ :sub:`2`,g\ :sub:`1`,g\ :sub:`0`,b\ :sub:`4`,b\ :sub:`3`,b\ :sub:`2`,b\ :sub:`1`,b\ :sub:`0`,,r\ :sub:`4`,r\ :sub:`3`,r\ :sub:`2`,r\ :sub:`1`,r\ :sub:`0`,g\ :sub:`5`,g\ :sub:`4`,g\ :sub:`3`
-  ``V4L2_PIX_FMT_ARGB555X``,'AR15' | (1<<31),,a,r\ :sub:`4`,r\ :sub:`3`,r\ :sub:`2`,r\ :sub:`1`,r\ :sub:`0`,g\ :sub:`4`,g\ :sub:`3`,,g\ :sub:`2`,g\ :sub:`1`,g\ :sub:`0`,b\ :sub:`4`,b\ :sub:`3`,b\ :sub:`2`,b\ :sub:`1`,b\ :sub:`0`
-  ``V4L2_PIX_FMT_XRGB555X``,'XR15' | (1<<31),,-,r\ :sub:`4`,r\ :sub:`3`,r\ :sub:`2`,r\ :sub

Re: Kernel docs: muddying the waters a bit

2016-03-04 Thread Johannes Stezenbach
On Fri, Mar 04, 2016 at 09:59:50AM -0300, Mauro Carvalho Chehab wrote:
> 
> 3) I tried to use a .. cssclass, as Johannes suggested, but
> I was not able to include the CSS file. I suspect that this is
> easy to fix, but I want to see if the cssclass will also work for
> the pdf output as well.

"cssclass" was (I think) a custom role defined in the example,
unless you also have defined a custom role you can use plain "class".
I have not looked deeper into the theming and template stuff.

> 4) It seems that it can't produce nested tables in pdf:
> 
> Markup is unsupported in LaTeX:
> v4l-table-within-table:: nested tables are not yet implemented.
> Makefile:115: recipe for target 'latexpdf' failed

This:
http://www.sphinx-doc.org/en/stable/markup/misc.html#tables

suggests you need to add the tabularcolumns directive
for complex tables.

BTW, as an alternative to the ASCII-art input
there is also support for CSV and list tables:
http://docutils.sourceforge.net/docs/ref/rst/directives.html#table


Johannes


Re: Kernel docs: muddying the waters a bit

2016-03-04 Thread Johannes Stezenbach
On Fri, Mar 04, 2016 at 10:29:08AM +0200, Jani Nikula wrote:
> On Fri, 04 Mar 2016, Mauro Carvalho Chehab  wrote:
> >
> > If, on the other hand, we decide to use RST, we'll very likely need to
> > patch it to fulfill our needs in order to add proper table support.
> > I've no idea how easy/difficult would be to do that, nor if Sphinx
> > upstream would accept such changes.
> >
> > So, at the end of the day, we may end by having to carry on our own
> > version of Sphinx inside our tree, with doesn't sound good, specially
> > since it is not just a script, but a package with hundreds of
> > files.
> 
> If we end up having to modify Sphinx, it has a powerful extension
> mechanism for this. We wouldn't have to worry about getting it merged to
> Sphinx upstream, and we wouldn't have to carry a local version of all of
> Sphinx. (In fact, the extension mechanism provides a future path for
> doing kernel-doc within Sphinx instead of as a preprocessing step.)
> 
> I know none of this alleviates your concerns with table supports right
> now. I'll try to have a look at that a bit more.

FWIW, I think table formatting in Sphinx works via style sheets.
The mechanism is documented in the Python docutils docs that
Sphinx is built upon.
Basically you use the "class" or "role" directive and define
the corresponding CSS or LaTeX (or rst2pdf) style.

Here is one example (using a custom "cssclass" role):
https://pythonhosted.org/sphinxjp.themes.basicstrap/sample.html

Directives (especially role and class):
http://www.sphinx-doc.org/en/stable/rest.html#directives

LaTeX styling:
http://docutils.readthedocs.org/en/sphinx-docs/user/latex.html#custom-interpreted-text-roles


HTH,
Johannes


Re: [PATCH 5/6] n_tty: Fix stuck write wakeup

2015-12-13 Thread Johannes Stezenbach
On Sun, Dec 13, 2015 at 10:38:02AM -0800, Peter Hurley wrote:
> On 12/13/2015 07:18 AM, Johannes Stezenbach wrote:
> > 
> > There is a related bug that I meant to send a patch, but I
> > never got around because the issue was found with proprietary
> > userspace and ancient kernel.  Maybe you could take care of it?
> > The patch might not apply cleanly after your recent changes
> > or might even be invalid now, please check.
> 
> Thanks for the patch, Johannes!
> 
> Yes, the patch below is still required to prevent excessive SIGIO
> (and to prevent missed SIGIO when the amount actually copied just
> happens to be exactly the amount left to be copied).
> 
> I made some comments in the patch; can you re-submit with those
> changes and the patch title in the subject? Or I'd happy to re-work
> it and send it to Greg if you'd prefer; just let me know.

Please rework it, currently I'm in lazy bum mode ;-)

> > @@ -1991,7 +1992,7 @@ static ssize_t n_tty_write(struct tty_st
> >  break_out:
> > __set_current_state(TASK_RUNNING);
> > remove_wait_queue(&tty->write_wait, &wait);
> > -   if (b - buf != nr && tty->fasync)
> > +   if (b - buf != count && tty->fasync)
> 
> ... this can be
> 
>   if (nr && tty->fasync)
>   set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);

Yeah, that's way better.

Thanks,
Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 5/6] n_tty: Fix stuck write wakeup

2015-12-13 Thread Johannes Stezenbach
Hi Peter,

On Sat, Dec 12, 2015 at 02:16:38PM -0800, Peter Hurley wrote:
> If signal-driven i/o is disabled while write wakeup is pending (ie.,
> n_tty_write() has set TTY_DO_WRITE_WAKEUP but then signal-driven i/o
> is disabled), the TTY_DO_WRITE_WAKEUP bit will never be cleared and
> will cause tty_wakeup() to always call n_tty_write_wakeup.
> 
> Unconditionally clear the write wakeup, and since kill_fasync()
> already checks if the fasync ptr is null, call kill_fasync()
> unconditionally as well.
...
> @@ -230,8 +230,8 @@ static ssize_t chars_in_buffer(struct tty_struct *tty)
>  
>  static void n_tty_write_wakeup(struct tty_struct *tty)
>  {
> - if (tty->fasync && test_and_clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags))
> - kill_fasync(&tty->fasync, SIGIO, POLL_OUT);
> + clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
> + kill_fasync(&tty->fasync, SIGIO, POLL_OUT);
>  }

There is a related bug that I meant to send a patch, but I
never got around because the issue was found with proprietary
userspace and ancient kernel.  Maybe you could take care of it?
The patch might not apply cleanly after your recent changes
or might even be invalid now, please check.

Thanks,
Johannes


---
tty: n_tty: fix SIGIO for output

According to fcntl(2), "a SIGIO signal is sent whenever input
or output becomes possible on that file descriptor", i.e.
after the output buffer was full and now has space for new data.
But in fact SIGIO is sent after every write.

n_tty_write() should set TTY_DO_WRITE_WAKEUP only when
not all data could be written to the buffer.

Signed-off-by: Johannes Stezenbach 

--- drivers/char/n_tty.c.orig   2015-11-02 22:26:04.124227148 +0100
+++ drivers/char/n_tty.c2015-11-02 22:26:10.644212115 +0100
@@ -1925,6 +1925,7 @@ static ssize_t n_tty_write(struct tty_st
DECLARE_WAITQUEUE(wait, current);
int c;
ssize_t retval = 0;
+   size_t count = nr;

/* Job control check -- must be done at start (POSIX.1 7.1.1.4). */
if (L_TOSTOP(tty) && file->f_op->write != redirected_tty_write) {
@@ -1991,7 +1992,7 @@ static ssize_t n_tty_write(struct tty_st
 break_out:
__set_current_state(TASK_RUNNING);
remove_wait_queue(&tty->write_wait, &wait);
-   if (b - buf != nr && tty->fasync)
+   if (b - buf != count && tty->fasync)
set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
return (b - buf) ? b - buf : retval;
 }


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/6] n_tty: Always wake up read()/poll() if new input

2015-12-13 Thread Johannes Stezenbach
Hi Peter,

On Sat, Dec 12, 2015 at 02:16:34PM -0800, Peter Hurley wrote:
> A read() in non-canonical mode when VMIN > 0 and VTIME == 0 does not
> complete until at least VMIN chars have been read (or the user buffer is
> full). In this infrequent read mode, n_tty_read() attempts to reduce
> wakeups by computing the amount of data still necessary to complete the
> read (minimum_to_wake) and only waking the read()/poll() when that much
> unread data has been processed. This is the only read mode for which
> new data does not necessarily generate a wakeup.
> 
> However, this optimization is broken and commonly leads to hung reads
> even though the necessary amount of data has been received. Since the
> optimization is of marginal value anyway, just remove the whole
> thing. This also remedies a race between a concurrent poll() and
> read() in this mode, where the poll() can reset the minimum_to_wake
> of the read() (and vice versa).
...
> @@ -1632,7 +1631,7 @@ static void __receive_buf(struct tty_struct *tty, const 
> unsigned char *cp,
>   /* publish read_head to consumer */
>   smp_store_release(&ldata->commit_head, ldata->read_head);
>  
> - if ((read_cnt(ldata) >= ldata->minimum_to_wake) || L_EXTPROC(tty)) {
> + if (read_cnt(ldata)) {
>   kill_fasync(&tty->fasync, SIGIO, POLL_IN);
>   wake_up_interruptible_poll(&tty->read_wait, POLLIN);
>   }

Your patch looks fine, I just want to mention that there was
some undocumented behaviour for async IO to take VMIN
into account for deciding when to send SIGIO, but it was
implemented incorrectly because minimum_to_wake was
only updated in read() and poll(), not directly by the
tcsetattr() ioctl.  I think your change does the right
thing to fix this case, too.  I had to debug some
proprietary code which dynamically changed VMIN based on
expected message size and thus sometimes wasn't woken up,
in the end we decided to keep VMIN=1 to solve it.


Thanks,
Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/4] tty: Abstract and encapsulate tty->closing behavior

2015-11-09 Thread Johannes Stezenbach
On Sun, Nov 08, 2015 at 05:02:52PM -0500, Peter Hurley wrote:
> +void tty_ldisc_closing(struct tty_struct *tty)
> +{
> + struct tty_ldisc *ld = tty_ldisc_ref(tty);
> +
> + if (ld->ops->closing)
> + ld->ops->closing(tty);
> + if (ld)
> + tty_ldisc_deref(ld);
> +}

That looks strange.  Do you need to check ld _before_ dereferencing?

Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] kdbus for 4.1-rc1

2015-07-07 Thread Johannes Stezenbach
On Mon, Apr 27, 2015 at 03:14:49PM -0700, Linus Torvalds wrote:
> On Mon, Apr 27, 2015 at 3:00 PM, Linus Torvalds
>  wrote:
> >
> > IOW, all the people who say that it's about avoiding context switches
> > are probably just full of shit. It's not about context switches, it's
> > about bad user-level code.
> 
> Just to make sure, I did a system-wide profile (so that you can
> actually see the overhead of context switching better), and that
> didn't change the picture.
> 
> The scheduler overhead *might* be 1% or so.
> 
> So really. The people who talk about how kdbus improves performance
> are just full of sh*t. Yes, it improves things, but the improvement
> seems to be 100% "incidental", in that it avoids a few trips down the
> user-space problems.

I was interested how plain UDS performs compared to the
dbus-client/dbus-server benchmark when doing a similar
transaction (RPC call from client1 to client2 via a server,
i.e 4 send() and 4 recv() syscalls per RPC msg).
Since I had worked on socket code for some project anyway, I
decided to write a stupid little benchmark.

On my machine, dbus-client/dbus-server needs ~200us per call (1024 byte msg),
UDS "dbus call" needs ~23us.  Of course, someone who cares about performance
wouldn't use sync RPC via a message broker, so I added
single-client and async mode to the benchmark for comparison.
Async mode not only decreases scheduling overhead, it also
can use two CPU cores, so it's more than twice as fast.

  ./server dbus
  (you need to run two clients, the timing loop starts
  when the second client connects)
  ./client sync 4096 100
 22.757250 s, 43942 msg/s, 22.8 us/msg, 171.638 MB/s
  ./client async 4096 100
 8.197482 s, 121989 msg/s, 8.2 us/msg, 476.488 MB/s
  ./server single
  (only a single client talks to the server)
  ./client sync 4096 100
 10.980143 s, 91073 msg/s, 11.0 us/msg, 355.733 MB/s
  ./client async 4096 100
 3.041953 s, 328736 msg/s, 3.0 us/msg, 1284.044 MB/s

In all cases 1 msg means "send request + receive response".


Johannes
/* UDS server */

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 


// use abstract address
#define SOCKET "\0udsbench.socket"

static int die(const char *msg)
{
	if (errno)
		fprintf(stderr, "%s: error %d %m\n", msg, errno);
	else
		fprintf(stderr, "%s\n", msg);
	if (errno != ECONNRESET)
		exit(EXIT_FAILURE);
	return 0;
}

int main(int argc, char *argv[])
{
	struct sockaddr_un addr = {
		.sun_family = AF_UNIX,
		.sun_path = SOCKET,
	};
	int sock, client1, client2 = -1, rc, len;
	struct pollfd pfd[2];
	char buf[65536];
	unsigned long cnt = 0;
	bool single = false;

	if (argc != 2)
		die("usage: server {single|dbus}");
	if (!strcmp(argv[1], "single"))
		single = true;
	printf("running in %s mode\n", single ? "single" : "dbus");

	sock = socket(AF_UNIX, SOCK_SEQPACKET, 0);
	if (sock < 0)
		die("can't create socket");
	if (bind(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0)
		die("can't bind address");
	if (listen(sock, 5) < 0)
		die("can't listen");

	printf("waiting for client 1\n");
	client1 = accept(sock, NULL, NULL);
	if (client1 < 0)
		die("accept");

	if (!single) {
		printf("waiting for client 2\n");
		client2 = accept(sock, NULL, NULL);
		if (client2 < 0)
			die("accept");

		write(client2, "\01", 1);
	}
	write(client1, "\0", 1);

	printf("enter event loop\n");
	pfd[0].fd = client1;
	pfd[1].fd = client2;
	pfd[0].events = pfd[1].events = POLLIN;
	for (;;) {
		rc = poll(pfd, single ? 1 : 2, -1);
		if (rc < 0)
			die("poll");
		if (pfd[0].revents & POLLIN) {
			len = read(client1, buf, sizeof(buf));
			if (len < 0) {
die("read from client 1");
break;
			}
			if (len == 0) {
printf("client 1 EOF\n");
break;
			}
			rc = write(single ? client1 : client2, buf, len);
			if (len != rc) {
die("write to client 2");
break;
			}
			cnt++;
		}
		if (pfd[1].revents & POLLIN) {
			len = read(client2, buf, sizeof(buf));
			if (len < 0) {
die("read from client 2");
break;
			}
			if (len == 0) {
printf("client 2 EOF\n");
break;
			}
			rc = write(client1, buf, len);
			if (len != rc) {
die("write to client 1");
break;
			}
			cnt++;
		}
	}
	printf("passed %lu messages\n", cnt);
	return EXIT_SUCCESS;
}
/* UDS client */

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 


// use abstract address
#define SOCKET "\0udsbench.socket"

static int die(const char *msg)
{
	if (errno)
		fprintf(stderr, "%s: error %d %m\n", msg, errno);
	else
		fprintf(stderr, "%s\n", msg);
	if (errno != EPIPE)
		exit(EXIT_FAILURE);
	return 0;
}

int main(int argc, char *argv[])
{
	struct sockaddr_un addr = {
		.sun_family = AF_UNIX,
		.sun_path = SOCKET,
	};
	int sock, rc, client = 1, i;
	char *buf;
	struct timespec start, end;
	double duration;
	bool async = false;
	struct pollfd pfd;
	typeof(&read) f1, f2;
	

Re: [GIT PULL] kdbus for 4.1-rc1

2015-04-22 Thread Johannes Stezenbach
On Tue, Apr 21, 2015 at 09:37:44AM -0400, Havoc Pennington wrote:
> 
> I think the pressure to use dbus happens for several reasons, if you
> use a side channel some example complaints people have are:
> 
>  * you have to reinvent any dbus solutions for security policy,
> containerization, debugging, introspection, etc.
>  * you're now writing custom socket code instead of using the
> high-level dbus API
>  * the side channel loses message ordering with respect to dbus messages
>  * your app code is kind of "infected" structurally by a performance
> optimization concern
>  * you have to decide in advance which messages are "too big" or "too
> numerous" - which may not be obvious, think of a cut-and-paste API,
> where usually it's a paragraph of text but it could in theory be a
> giant image
>  * you can't do big/numerous multicast, side channel only solves the unicast
> 
> There's no doubt that it's possible to use a side channel - just as it
> was possible to construct an ad hoc IPC system prior to dbus - but the
> overall OS (counting both kernel and userspace) perhaps becomes more
> complex as a result, compared to having one model that supports more
> cases.
> 
> One way to frame it: the low performance makes dbus into a relatively
> leaky abstraction where there's this surprise lurking for app
> developers that they might have to roll their own IPC on the side or
> special-case some of their messages.
> 
> it's not the end of the world, it's just that it would have a certain
> amount of overall simplicity (counting userspace+kernel together) if
> one solution covered almost all use-cases in this "process-to-process
> comms on local system" scenario, instead of 90% of use-cases but too
> slow for the last 10%. The simplicity here isn't only for app
> developers, it's also for anyone doing debugging or administration or
> system integration, where they can deal with one system _or_ one
> system plus various ad-hoc side channels.

Clearly it is not useful to put the burden on the app developers.
However, I do not (yet?) understand why direct links couldn't be added
to the DBus daemon and library and be used fairly transparently
by apps:
- allow peers to announce "I allow direct connect"
  (we don't want to many sockets/connections, just e.g.
  gconf, polkit, ... where it matters for performance)
- when clients do an RPC call, check if the server allows direct
  connect and then do it (via DBus daemon as helper)
- obviously the clients would maintain the connection to the
  DBus daemon for the remaining purposes

Of course. that means the DBus daemon cannot enforce the policy
anymore, you could use the same database but the code which uses
it would have to be moved into the dbus library.
I must admit that I do not understand the importance of
message ordering between some RPC call and other messages
via the DBus daemon since the app can do the RPC call at any time.

Wrt big/numerous multicast, you are right that this wouldn't
solve it, but doesn't seem the problem we need to address?
At least I've not seen any performance measurements which
would indicate it.

That all said, I'm not opposed at all to adding kernel
infrastructure for the benefit of DBus.  However, I am
quite disappointed both by the monolithic, single-purpose
design of the kdbus API, and especially by the way it
is presented to the kernel community.  What I mean by the
latter is that we get an amount kernel code which you cannot
understand unless you also understand the userspace
DBus *and* the actual usage of DBus in desktop systems,
and this is accompanied with statements along the line
of "many smart people worked on this for two years and
everyone agreed".  I.e., we only get the solution
but not the bckground knowledge to understand and judge
the solution for ourselves.

What I had appreciated instead:
- performance meansurement results which demontrate
  the problem and the actual DBus use in practice for
  various message type / use cases
- an account of the attempts that have been made to
  fix it and the reasons why they failed, so we can
  understand how the current design has evolved

The latter may be asking a lot, but IPC is a core OS feature
which comes right after CPU and memory resource management
and basic I/O.  The basic IPC APIs are fairly simple, the
socket API is already quite complex, and kdbus goes to
another level of complexity and cruftiness, and with all
the words which have been written in this thread there is
still not an adequate justification for it.

For example, I do understand the policy database has to be
in the kernel as it is checked for every message, but I
don't see why the name service needs to be in the kernel.
I suspect (lacking performance figures) that name ownership
changes are relatively rare, and lookups, too (ISTR you mentioned
clients cache the result).

For the base messaging and policy filtering I don't see why
this has to be one monolithic API and not split in a
fairly simple, general purpo

Re: [GIT PULL] kdbus for 4.1-rc1

2015-04-21 Thread Johannes Stezenbach
On Mon, Apr 20, 2015 at 11:16:49PM +0200, Richard Weinberger wrote:
> Am 20.04.2015 um 22:56 schrieb Greg Kroah-Hartman:
> >> In which situation on a common Linux system is the current dbus too slow 
> >> today?
> >> I've never seen a issue like "Oh my system is slow because dbus is
> >> eating too much CPU cycles".
> > 
> > See the original email which explained all of the things we can not do
> > with D-Bus, some of which are due to speed, that can now be done with the
> > kdbus code.
> 
> okay, let's do it together.
> 
> 1. Performance
> You write:
> "DBus is not used for performance sensitive applications because DBus is slow.
> We want to make it fast so we can finally use it for low-latency,
> high-throughput applications."
> 
> Which applications exactly?
> This reads to me like a solution for a non-existing problem.

This is the line of thinking I was aiming at during a previous
review cycle.  Basically, as Havoc outlined in his mail explaining
the design decisions, he traded speed for simplicity and chose
the slowest possible messaging topology (everything goes through
a central broker).  That makes sense because, to quote from his mail:

http://article.gmane.org/gmane.linux.kernel/1931720
  > Message passing or IPC isn't really the most important part of dbus.
  > Process lifecycle tracking and discovery are more important.

I asked for performance numbers and got this reply from David Herrmann:
http://article.gmane.org/gmane.linux.kernel.api/7636

My line of thinking had been to amend DBus with optional direct
client/server communication for the performance critical
cases, since I believe those cases are RPC calls and not other
types of messaging (see also the "Performance" section in the
cover letter of this thread).  (My other line of thinking had
been: if you need performance, don't use DBus e.g. in the
case of the tiny ARM systems sending hundreds of thousands of
messages during boot, quoted by Greg.)

Now, after reading Havoc's description of the DBus design
trade-offs, I have doubts that modifiying the DBus architecture
in userspace to speed it up is a good thing.  OTOH I am
still convinced kdbus is the wrong solution, for the sole
reason called gut feeling.  There is nothing about the kdbus API
that makes me go "oh nice, elegant, I want to use it".  And
the kdbus authors seem to agree and tell you you should only ever
use it via a library like sd-bus and try to justify it by
comparing it to ALSA :-(

The ideas discussed among Alan, Andy and Al, even if ad-hoc
and yet immature, immediately seemed to be much more
appealing to me.  I hope something real comes out of that.


Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] kdbus for 4.1-rc1

2015-04-21 Thread Johannes Stezenbach
On Mon, Apr 20, 2015 at 03:06:09PM -0700, Andy Lutomirski wrote:
> 
> I do.  Implement something like my old SCM_IDENTITY proposal, which is
> kind of like kdbus metadata, opt-in, over UNIX sockets.  Except that I
> never proposed most of the absurd metadata items that kdbus is
> proposing, and I also suggesting doing it over plain old UNIX sockets.

I'd like to point out that the DBus spec describes a fairly
standard per-connection authentication mechanism.
It seems that userspace DBus doesn't need per-message metadata.


Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 01/13] kdbus: add documentation

2015-01-20 Thread Johannes Stezenbach
Hi David,

On Tue, Jan 20, 2015 at 06:00:28PM +0100, David Herrmann wrote:
[big snip]
> These are just examples off the top of my head, but I think they're
> already pretty convincing.

Thank you for writing this up.  This is the information I was
looking for which puts kdbus into context and explains
the motivation for its development.  Naturally I don't agree
with all of it, but I'm content with what I learned so far.

Daniel informed me off-list that he (and probably others) does
not understand what my questions were aiming at.  I'm sorry
about that, I thought it was clear I was just lacking
the background information to understand what kdbus is and
what it is not, and why it exists -- information I couldn't find
in some hours of googling.


Thanks,
Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 01/13] kdbus: add documentation

2015-01-20 Thread Johannes Stezenbach
Hi all,

On Tue, Jan 20, 2015 at 03:53:53PM +0100, Djalal Harouni wrote:
> On Tue, Jan 20, 2015 at 09:42:59AM -0500, Josh Boyer wrote:
> > On Tue, Jan 20, 2015 at 9:31 AM, David Herrmann  
> > wrote:
> > >
> > > If you run a 3.18 kernel, you can install kdbus.ko from our repository
> > > and boot a full Fedora system running Gnome3 with kdbus, given that
> > > you compiled systemd with --enable-kdbus (which is still
> > > experimental). No legacy dbus1 daemon is running. Instead, we have a
> > > bus-proxy that converts classic dbus1 to kdbus, so all
> > > bus-communication runs on kdbus.
> > 
> > FWIW, we've been building a "playground" repository for the kernel
> > that contains this already for Fedora.  If you have a stock Fedora 21
> > or rawhide install, you can use:
> > 
> > https://copr.fedoraproject.org/coprs/jwboyer/kernel-playground/
> > 
> > which has the kernel+kdbus and systemd built with --enable-kdbus
> > already.  Easy enough to throw in a VM for testing.
> 
> Another addition, if kdbus is installed and loaded, you could also use
> systemd-nspawn to boot a full system (systemd compiled with
> --enable-kdbus) in a container [1], kdbusfs will be mounted in the
> container.
> 
> There is also the busctl tool to query kdbus...
> 
> http://www.freedesktop.org/wiki/Software/systemd/VirtualizedTesting/

It is reassuring that kdbus actually works :)

However, let me repeat and rephrase my previous questions:
Is there a noticable or measurable improvement from using kdbus?
IOW, is the added complexity of kdbus worth the result?

I have stated my believe that current usage of D-Bus is not
performance sensitive and the number of messages exchanged
is low.  I would love it if you would prove me wrong.
Or if you could show that any D-Bus related bug in Gnome3
is fixed by kdbus.

I would sooo love it if someone would finally post some
data that proves kdbus is useful beyond systemd.


Thanks,
Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 00/13] Add kdbus implementation

2015-01-20 Thread Johannes Stezenbach
On Tue, Jan 20, 2015 at 07:26:09PM +0800, Greg Kroah-Hartman wrote:
> On Tue, Jan 20, 2015 at 11:57:12AM +0100, Johannes Stezenbach wrote:
> > 
> > So I did some googling and found in QNX servers create a channel
> > to receive messages, and clients connect to this channel.
> > Multiple clients can connect to the channel.
> 
> Hence, a bus :)
> 
> > But it is not a bus -- no multicast/broadcast, and no name
> > service or policy rules like D-Bus has.  To me it looks
> > to be similar in functionality to UNIX domain sockets.
> 
> It's not as complex as D-Bus, but it's still subscribing to things and
> getting messages.

Apparently you don't read what I write, probably you're not interested
in this discussion anymore...
QNX uses the term "channel" but it does not refer to a bus
or subscription facility, it is more like a socket in listening state.

> > My guess is that the people porting from QNX were just confused
> > and their use of D-Bus was in error.  Maybe they should've used
> > plain sockets, capnproto, ZeroMQ or whatever.
> 
> I tend to trust that they knew what they were doing, they wouldn't have
> picked D-Bus for no good reason.

The automotive developers I had the pleasure to work with would
use anything which is available via a mouse click in the
commercial Embedded Linux SDK IDE of their choice :)
Let's face it: QNX has a single IPC solution while Linux has
a confusing multitude of possibilities.

> > Well, IMHO you got it backwards.  Before adding a complex new IPC
> > API to the kernel you should do the homework and gather some
> > evidence that there will be enough users to justify the addition.
> 
> systemd wants this today for early boot.  It will remove lots of code
> and enable a lot of good things to happen.  The first email in this
> thread describes this quite well, is that not sufficient?

The first mail in this thread doesn't even mention systemd,
instead it has a lot of "marketing" buzzwords.
Of course it is no secret that systemd is the driving force
behind kdbus, but no public record exists to explain why
kdbus was chosen and designed the way it is, what alternatives
were considered and rejected etc.  (or if there is, please send a link)

> > FWIW, my gut feeling was that the earlier attempts to add a new
> > IPC primitve like multicast UNIX domain sockets
> > http://thread.gmane.org/gmane.linux.kernel/1255575/focus=1257999
> > were a much saner approach.  But now I think the comments
> > from this old thread have not been addressed, instead the
> > new approach just made the thing more complex and
> > put in ipc/ instead of net/ to bypass the guards.
> 
> Not at all, the networking maintainers said that that proposal was not
> acceptable to them at all and it should not be done in the networking
> stack at all.  So this was solution was created instead, which provides
> a lot more things than the old networking patches did, which shows that
> the networking developers were right to reject it.

Please read the gmane thread to the end.  It seems there were
several indications that D-Bus can be improved in userspace
using existing kernel facilities.  Havoc Pennington's mail
I quoted in my first response also contains some hints
about it.  I have no idea if any of this has ever been
pursued.  While adding complexity to critical net/ code paths
is probematic and a good reason to reject it, this was not
the only reason, the major one being "not neccessary".


Thanks,
Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 00/13] Add kdbus implementation

2015-01-20 Thread Johannes Stezenbach
On Tue, Jan 20, 2015 at 09:13:59AM +0800, Greg Kroah-Hartman wrote:
> On Tue, Jan 20, 2015 at 12:38:12AM +0100, Johannes Stezenbach wrote:
> > Those automotive applications you
> > were talking about, what was the OS they were ported from
> > and what was the messaging API they used?
> 
> They were ported from QNX and I don't know the exact api, it is wrapped
> up in a library layer for them to use.  And typically, they run about
> 40 thousand messages in the first few seconds of startup time.  Or was
> it 400 thousand?  Something huge and crazy to be doing on tiny ARM
> chips, but that's the IVI industry for you :(

So I did some googling and found in QNX servers create a channel
to receive messages, and clients connect to this channel.
Multiple clients can connect to the channel.
But it is not a bus -- no multicast/broadcast, and no name
service or policy rules like D-Bus has.  To me it looks
to be similar in functionality to UNIX domain sockets.

My guess is that the people porting from QNX were just confused
and their use of D-Bus was in error.  Maybe they should've used
plain sockets, capnproto, ZeroMQ or whatever.


> > As I said before, I'm seeing about a dozen D-Bus messages per minute,
> > nothing that would justify adding kdbus to the kernel for
> > performance reasons.  Wrt security I'm also not aware of any
> > open issues with D-Bus.  Thus I doubt normal users of D-Bus
> > would see any benefit from kdbus.  I also think none of the
> > applications I can install from my distribution has any performance
> > issue with D-Bus.
> 
> That's because people have not done anything really needing performance
> on the desktop over D-Bus in the past due to how slow the current
> implementation is.  Now that this is being resolved, that can change,
> and there are demos out there of even streaming audio over kdbus with no
> problems.
> 
> But performance is not just the only reason we want this in the kernel,
> I listed a whole long range of them.  Sure, it's great to now be faster,
> cutting down the number of context switches and copies by a huge amount,
> but the other things are equally important for future development
> (namespaces, containers, security, early-boot, etc.)
> 
> > And this is the point where I ask myself if I missed something.
> 
> Don't focus purely on performance for your existing desktop system,
> that's not the only use case here.  There are lots of others, as I
> document, that can benefit and want this.
> 
> One "fun" thing I've been talking to someone about is the ability to
> even port binder to be on top of kdbus.  But that's just a research
> project, and requires some API changes on the userspace binder side, but
> it shows real promise, and would then mean that we could deprecate the
> old binder code and a few hundred million devices could then use kdbus
> instead.  But that's long-term goals, not really all that relevant here,
> but it shows that having a solid bus IPC mechanism is a powerful thing
> that we have been missing in the past from Linux.

Well, IMHO you got it backwards.  Before adding a complex new IPC
API to the kernel you should do the homework and gather some
evidence that there will be enough users to justify the addition.

But maybe I misunderstood the purpose of this thread and you're
just advertising it to find possible users instead of already
suggesting to merge it?  If someone has some convincing story
to share why kdbus would solve their IPC needs, I'm all ears.

(I'm sorry this implies your responses so far were not convincing:
not verifiable facts, no numbers, no testimonials etc.)

FWIW, my gut feeling was that the earlier attempts to add a new
IPC primitve like multicast UNIX domain sockets
http://thread.gmane.org/gmane.linux.kernel/1255575/focus=1257999
were a much saner approach.  But now I think the comments
from this old thread have not been addressed, instead the
new approach just made the thing more complex and
put in ipc/ instead of net/ to bypass the guards.


Thanks,
Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 00/13] Add kdbus implementation

2015-01-19 Thread Johannes Stezenbach
On Tue, Jan 20, 2015 at 04:31:55AM +0800, Greg Kroah-Hartman wrote:
> On Mon, Jan 19, 2015 at 09:19:06PM +0100, Johannes Stezenbach wrote:
> > These two statements somehow contradict. From my admittedly very
> > limited experience, I never used D-Bus because it did not
> > fit my usage scenarios: I never needed a bus, only point-to-point
> > links like pipes or sockets.
> 
> Great, then you don't need this, no need to worry about it at all, why
> are we having this conversation? :)

Well, for one because that's what I wanted to find out...

> > Well, it made your intentions a bit clearer, but it does
> > not help to sell kdbus to me, sorry ;-/
> 
> It's not my "goal" to sell kdbus to you, if you don't want it, great,

I used this language because I think you're not providing
the facts that would allow me to judge for myself whether
kdbus is a good idea.  Those automotive applications you
were talking about, what was the OS they were ported from
and what was the messaging API they used?

> But odds are, you are using a system with D-Bus today, if not, then you
> are using Linux in a very specific and limited manner, which is
> wonderful, in that case this whole thread isn't really pertinent.
> 
> Lots of people do use D-Bus, and for those users, that is what this
> patchset is for.

As I said before, I'm seeing about a dozen D-Bus messages per minute,
nothing that would justify adding kdbus to the kernel for
performance reasons.  Wrt security I'm also not aware of any
open issues with D-Bus.  Thus I doubt normal users of D-Bus
would see any benefit from kdbus.  I also think none of the
applications I can install from my distribution has any performance
issue with D-Bus.

And this is the point where I ask myself if I missed something.


Thanks,
Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 00/13] Add kdbus implementation

2015-01-19 Thread Johannes Stezenbach
On Tue, Jan 20, 2015 at 02:38:06AM +0800, Greg Kroah-Hartman wrote:
> Yes, I do agree, there are lots of existing ipc solutions today that
> kdbus is not designed for, nor would it be good to use it for.  The
> majority of them being IPC that crosses the network layer, as there are
> lots of good solutions today for that problem.  That being said, I do
> know one research group that has kdbus working cross-network, just "to
> try it out", but I don't know what ever came of it.
...
> Everyone uses D-Bus today for everything on their system, so by
> replacing the underlying library with kdbus, they will continue to use
> it for everything without having to change any application or library
> code at all.

These two statements somehow contradict. From my admittedly very
limited experience, I never used D-Bus because it did not
fit my usage scenarios: I never needed a bus, only point-to-point
links like pipes or sockets.

Let me rephrase my previous, lengthy mail: Will kdbus only
support the same IPC model as D-Bus (just with higher
performance and some bells and whistles), or will it
be useful for other scenarios?  Like, can two programs
use it to communicate directly without the need of
any daemon?  (And if so, would there be any advantage
compared to traditional UNIX IPC methods?)

You were comparing kdbus and Binder.  Why?
So far my impression is that D-Bus and Binder are
completely seperate things, not just because of
the thread vs. event-loop programming model but
also because Binder is not a bus (i.e. no multicast messaging).

> Hope this helps,

Well, it made your intentions a bit clearer, but it does
not help to sell kdbus to me, sorry ;-/


Thanks,
Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 00/13] Add kdbus implementation

2015-01-19 Thread Johannes Stezenbach
(resend, fix Daniel's email address)

Hi Greg and Daniel,

I don't have a clue so I need to ask some stupid questions...

On Fri, Jan 16, 2015 at 11:16:04AM -0800, Greg Kroah-Hartman wrote:
> kdbus is a kernel-level IPC implementation that aims for resemblance to
> the the protocol layer with the existing userspace D-Bus daemon while
> enabling some features that couldn't be implemented before in userspace.
> 
> The documentation in the first patch in this series explains the
> protocol and the API details.

How about the big picture?

> Reasons why this should be done in the kernel, instead of userspace as
> it is currently done today include the following:
[abbreviated]
> - performance
> - security
> - semantics for apps with heavy data payloads


First of all I wonder about the relationship with D-Bus.
http://dbus.freedesktop.org/doc/dbus-specification.html says:

   D-Bus is designed for two specific use cases:

   A "system bus" for notifications from the system to user
   sessions, and to allow the system to request input from
   user sessions.

   A "session bus" used to implement desktop environments such
   as GNOME and KDE. 

   D-Bus is not intended to be a generic IPC system for any
   possible application, and intentionally omits many features
   found in other IPC systems for this reason. 

Does this also apply to kdbus?  If not, what are the
suggested uses of kdbus beyond those where D-Bus is
currently used?

Another related quote by Havoc Pennington:
http://lists.freedesktop.org/archives/dbus/2012-March/015024.html

   In general, reading this, I think in some cases there are
   problems that make sense to fix in dbus, and in other cases
   there are problems that are best solved by not using dbus.
   ...
   there are about 1 IPC solutions already, from ICE (both of
   them) to ZeroMQ to AMQP to CORBA to X11 to HTTP to SOAP to
   WebSockets to SUN-RPC to whatever-the-heck. To me, trying to
   make dbus configurable so that it can substitute for any of
   these is a Bad Idea (tm).

Do you think it also applies to kdbus?


Wrt the performance improvement achieved by kdbus, my impression
about D-Bus is that the number of messages on my system is
about a dozen per minute.  Are there actually any existing
applications using D-Bus that have a performance issue?
Or is this only about future possible uses?


Linked from http://kroah.com/log/blog/2014/01/15/kdbus-details/,
http://lwn.net/Articles/580194/ "The unveiling of kdbus" says:

   Unlike most other kernels, Linux has never had a well-designed
   IPC mechanism. Windows and Mac OS have this feature; even
   Android, based on Linux, has one in the form of the "binder"
   subsystem. Linux, instead, has only had the primitives —
   sockets, FIFOs, and shared memory — but those have never been
   knitted together into a reasonable application-level API. Kdbus
   is an attempt to do that knitting and create something that is
   at least as good as the mechanisms found on other systems.

These are bold words. I'm not sure what Windows and Mac OS
have in terms of IPC, but the above suggests that kdbus
is *the* new Linux IPC that everyone will use for everything,
rather than a special purpose facility.
True?


Thanks,
Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 00/13] Add kdbus implementation

2015-01-19 Thread Johannes Stezenbach
Hi Greg and Daniel,

I don't have a clue so I need to ask some stupid questions...

On Fri, Jan 16, 2015 at 11:16:04AM -0800, Greg Kroah-Hartman wrote:
> kdbus is a kernel-level IPC implementation that aims for resemblance to
> the the protocol layer with the existing userspace D-Bus daemon while
> enabling some features that couldn't be implemented before in userspace.
> 
> The documentation in the first patch in this series explains the
> protocol and the API details.

How about the big picture?

> Reasons why this should be done in the kernel, instead of userspace as
> it is currently done today include the following:
[abbreviated]
> - performance
> - security
> - semantics for apps with heavy data payloads


First of all I wonder about the relationship with D-Bus.
http://dbus.freedesktop.org/doc/dbus-specification.html says:

   D-Bus is designed for two specific use cases:

   A "system bus" for notifications from the system to user
   sessions, and to allow the system to request input from
   user sessions.

   A "session bus" used to implement desktop environments such
   as GNOME and KDE. 

   D-Bus is not intended to be a generic IPC system for any
   possible application, and intentionally omits many features
   found in other IPC systems for this reason. 

Does this also apply to kdbus?  If not, what are the
suggested uses of kdbus beyond those where D-Bus is
currently used?

Another related quote by Havoc Pennington:
http://lists.freedesktop.org/archives/dbus/2012-March/015024.html

   In general, reading this, I think in some cases there are
   problems that make sense to fix in dbus, and in other cases
   there are problems that are best solved by not using dbus.
   ...
   there are about 1 IPC solutions already, from ICE (both of
   them) to ZeroMQ to AMQP to CORBA to X11 to HTTP to SOAP to
   WebSockets to SUN-RPC to whatever-the-heck. To me, trying to
   make dbus configurable so that it can substitute for any of
   these is a Bad Idea (tm).

Do you think it also applies to kdbus?


Wrt the performance improvement achieved by kdbus, my impression
about D-Bus is that the number of messages on my system is
about a dozen per minute.  Are there actually any existing
applications using D-Bus that have a performance issue?
Or is this only about future possible uses?


Linked from http://kroah.com/log/blog/2014/01/15/kdbus-details/,
http://lwn.net/Articles/580194/ "The unveiling of kdbus" says:

   Unlike most other kernels, Linux has never had a well-designed
   IPC mechanism. Windows and Mac OS have this feature; even
   Android, based on Linux, has one in the form of the "binder"
   subsystem. Linux, instead, has only had the primitives —
   sockets, FIFOs, and shared memory — but those have never been
   knitted together into a reasonable application-level API. Kdbus
   is an attempt to do that knitting and create something that is
   at least as good as the mechanisms found on other systems.

These are bold words. I'm not sure what Windows and Mac OS
have in terms of IPC, but the above suggests that kdbus
is *the* new Linux IPC that everyone will use for everything,
rather than a special purpose facility.
True?


Thanks,
Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: using DMA-API on ARM

2014-12-08 Thread Johannes Stezenbach
On Mon, Dec 08, 2014 at 03:55:57PM +, Catalin Marinas wrote:
> On Mon, Dec 08, 2014 at 12:55:38PM +0000, Johannes Stezenbach wrote:
> > On Fri, Dec 05, 2014 at 06:53:03PM +, Catalin Marinas wrote:
> > > 
> > > BTW, if you really have a PL310-like L2 cache, have a look at some
> > > patches (I've seen similar symptoms) and make sure your configuration is
> > > correct:
> > > 
> > > http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6395/1
> > > 
> > > http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6529/1
> > > 
> > > The first one is vexpress specific. The second one was eventually
> > > discarded by Russell (I don't remember the reason, I guess it's because
> > > SoC code is supposed to set the right bits in there anyway). In your
> > > case, such bits may be set up by firmware, so Linux cannot fix anything
> > > up.
> > 
> > How do you avoid the unpredictable behavior mentioned in the
> > PL310 TRM when the Shared Attribute Invalidate Enable bit is set?
> > http://infocenter.arm.com/help/topic/com.arm.doc.ddi0246h/Ceggcfcj.html
> 
> So you talk about "Shared Attribute _Invalidate_ Enable" (bit 13) while
> I talk about "Shared Attribute _Override_ Enable" (bit 22).
> 
> In addition, Shared _Invalidate_ behaviour can only be enabled if Shared
> Attribute _Override_ Enable bit is not set.

Yeah, I got confused, sorry for the noise.

Thanks,
Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: using DMA-API on ARM

2014-12-08 Thread Johannes Stezenbach
On Fri, Dec 05, 2014 at 06:53:03PM +, Catalin Marinas wrote:
> On Fri, Dec 05, 2014 at 06:39:45PM +, Catalin Marinas wrote:
> > 
> > Does your system have an L2 cache? What's the SoC topology, can PCIe see
> > such L2 cache (or snoop the L1 caches)?
> 
> BTW, if you really have a PL310-like L2 cache, have a look at some
> patches (I've seen similar symptoms) and make sure your configuration is
> correct:
> 
> http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6395/1
> 
> http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6529/1
> 
> The first one is vexpress specific. The second one was eventually
> discarded by Russell (I don't remember the reason, I guess it's because
> SoC code is supposed to set the right bits in there anyway). In your
> case, such bits may be set up by firmware, so Linux cannot fix anything
> up.

How do you avoid the unpredictable behavior mentioned in the
PL310 TRM when the Shared Attribute Invalidate Enable bit is set?
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0246h/Ceggcfcj.html

I think this bit does not do what you seem to think it does, it only
changes behaviour for "writes targeting a full cache line, for example
4x64-bit bursts with all strobes active", which then cause the
cacheline to be invalidated.  "Other cases are identical to the default
shared behavior", which is "cacheable no allocate for reads"
and "write through no write allocate for writes".

If the problem is really speculative reads via the cachable
alias mapping, it seems this bit cannot solve the problem, right?


Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: i915 INFO: trying to register non-static key.

2013-08-05 Thread Johannes Stezenbach
Hi,

wrt to $Subject, I get this with 3.10.5:

[4.342638] i915 :00:02.0: setting latency timer to 64
[4.409045] INFO: trying to register non-static key.
[4.409164] the code is fine but needs lockdep annotation.
[4.409278] turning off the locking correctness validator.
[4.409396] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 3.10.5 #1
[4.409514] Hardware name: LENOVO 2320CTO/2320CTO, BIOS G2ET82WW (2.02 ) 
09/11/2012
[4.409690]  0001 8802121559e0 816b265c 
880212155a50
[4.410050]  8109ba03 822cd1c0  
00010006
[4.410408]     
8802121587a8
[4.410764] Call Trace:
[4.410880]  [] dump_stack+0x19/0x1b
[4.411000]  [] __lock_acquire.isra.23+0x7f7/0xb9c
[4.411120]  [] lock_acquire+0xc0/0x142
[4.411240]  [] ? i915_write32+0x99/0x13a
[4.411360]  [] _raw_spin_lock_irqsave+0x57/0x8e
[4.411481]  [] ? i915_write32+0x99/0x13a
[4.411599]  [] i915_write32+0x99/0x13a
[4.411718]  [] intel_disable_gt_powersave+0x264/0x2e5
[4.411839]  [] intel_gt_sanitize+0x91/0x93
[4.411956]  [] i915_driver_load+0x6e7/0xca5
[4.412080]  [] ? drm_get_minor+0x1d4/0x22e
[4.412199]  [] drm_get_pci_dev+0x169/0x269
[4.412319]  [] ? _raw_spin_unlock_irqrestore+0x5b/0x79
[4.412440]  [] i915_pci_probe+0x66/0x6f
[4.412557]  [] pci_device_probe+0x6e/0xb2
[4.412679]  [] driver_probe_device+0x11a/0x2e2
[4.412799]  [] __driver_attach+0x61/0x83
[4.412918]  [] ? __device_attach+0x3d/0x3d
[4.413039]  [] bus_for_each_dev+0x7d/0x87
[4.413158]  [] driver_attach+0x1e/0x20
[4.413278]  [] bus_add_driver+0x128/0x233
[4.413397]  [] driver_register+0x8c/0xfd
[4.413515]  [] __pci_register_driver+0x5d/0x60
[4.413637]  [] ? 
ftrace_define_fields_drm_vblank_event_delivered+0x9a/0x9a
[4.413818]  [] drm_pci_init+0x86/0xea
[4.413936]  [] ? 
ftrace_define_fields_drm_vblank_event_delivered+0x9a/0x9a
[4.414117]  [] i915_init+0x66/0x68
[4.414235]  [] do_one_initcall+0xa0/0x13f
[4.414355]  [] kernel_init_freeable+0x115/0x196
[4.414475]  [] ? do_early_param+0x88/0x88
[4.414594]  [] ? rest_init+0xc2/0xc2
[4.414711]  [] kernel_init+0xe/0xd6
[4.414828]  [] ret_from_fork+0x7c/0xb0
[4.414946]  [] ? rest_init+0xc2/0xc2
[4.422529] i915 :00:02.0: irq 40 for MSI/MSI-X

If you have a fix for it please send it to stable.

Thanks,
Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: i915 INFO: trying to register non-static key.

2013-08-05 Thread Johannes Stezenbach
On Mon, Aug 05, 2013 at 03:27:29PM +0200, Borislav Petkov wrote:
> On Mon, Aug 05, 2013 at 03:23:53PM +0200, Johannes Stezenbach wrote:
> > wrt to $Subject, I get this with 3.10.5:
> > 
> > [4.342638] i915 :00:02.0: setting latency timer to 64
> > [4.409045] INFO: trying to register non-static key.
> > [4.409164] the code is fine but needs lockdep annotation.
> > [4.409278] turning off the locking correctness validator.
> > [4.409396] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 3.10.5 #1
> > [4.409514] Hardware name: LENOVO 2320CTO/2320CTO, BIOS G2ET82WW (2.02 ) 
> > 09/11/2012
> > [4.409690]  0001 8802121559e0 816b265c 
> > 880212155a50
> > [4.410050]  8109ba03 822cd1c0  
> > 00010006
> > [4.410408]     
> > 8802121587a8
> 
> Looks similar to what I'm seeing. Can you cherry-pick
> 
> commit e1b4d3036c07ff137955fb1c0197ab62534f46ec
> Author: Ben Widawsky 
> Date:   Tue Jul 30 16:27:57 2013 -0700
> 
> drm/i915: fix missed hunk after GT access breakage
> 
> ontop of 3.10-stable?

This is already in 3.10.5 as commit c9af307d38974264922d35c77bb71087d171f8f8.

Thanks,
Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH v2 0/4] Add support for LZ4-compressed kernel

2013-02-27 Thread Johannes Stezenbach
On Wed, Feb 27, 2013 at 09:51:39AM +, Russell King - ARM Linux wrote:
> On Wed, Feb 27, 2013 at 04:36:47PM +0900, Kyungsik Lee wrote:
> > Compiler: Linaro ARM gcc 4.6.2
> > 2. ARMv7, 1.7GHz based board
> >Kernel: linux 3.7
> >Uncompressed Kernel Size: 14MB
> >  Compressed Size  Decompression Speed
> > LZO  6.0MB34.1MB/sOld
> >  
> >  6.0MB34.7MB/sNew
> >  6.0MB52.2MB/s(UA)
> > =
> > LZ4  6.5MB86.7MB/s
> > UA: Unaligned memory Access support
> 
> That is pretty conclusive - it shows an 8% increase in image size vs a
> 66% increase in decompression speed.  It will take a _lot_ to offset
> that increase in decompression speed.
> 
> So, what I think is that yes, we should accept LZ4 and drop LZO from
> the kernel - the "fast but may not be small" compression title has
> clearly been taken by LZ4.

I think LZO may be used by squashfs, jffs2 and btrfs, thus you
cannot drop it without breaking on disk storage formats.

Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 0/4] Add support for LZ4-compressed kernels

2013-02-05 Thread Johannes Stezenbach
On Mon, Feb 04, 2013 at 10:50:52AM +, Russell King - ARM Linux wrote:
> On Mon, Feb 04, 2013 at 03:02:49AM +0100, Markus F.X.J. Oberhumer wrote:
> > At least akpm did approve the LZO update for inclusion into 3.7, but the 
> > code
> > still has not been merged into the main tree.
> >   > On 2012-10-09 21:26, Andrew Morton wrote:
> >   > [...]
> >   > The changes look OK to me.  Please ask Stephen to include the tree in
> >   > linux-next, for a 3.7 merge.
> > 
> > Well, this probably means I have done a rather poor marketing.
> 
> I assume this code is sitting in *your* tree?  How do you think it gets
> into mainline?
> 
> There is no automatic way that code from linux-next gets merged into
> mainline.  That is up to the tree owner to make happen, either by getting
> their tree into a parent maintainers tree, or if there is none, asking
> Linus to pull your tree at the appropriate time.

My feeling is that in this case it is unneccessarily hard
for an outside contributor to get a patch accepted, all
because get_maintainer.pl doesn't put someone in charge.

Apparently it doesn't work to put all the usual maintainer
responsibilities onto the shoulders of a Linux development novice.
Thus it would be nice if some maintainer would come
forward and offer to handle the patches for Markus.


Thanks,
Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 0/4] Add support for LZ4-compressed kernels

2013-01-30 Thread Johannes Stezenbach
On Mon, Jan 28, 2013 at 11:29:14PM -0500, Nicolas Pitre wrote:
> On Mon, 28 Jan 2013, Andrew Morton wrote:
> 
> > On Sat, 26 Jan 2013 14:50:43 +0900
> > Kyungsik Lee  wrote:
> > 
> > > This patchset is for supporting LZ4 compressed kernel and initial ramdisk 
> > > on
> > > the x86 and ARM architectures.
> > > 
> > > According to http://code.google.com/p/lz4/, LZ4 is a very fast lossless
> > > compression algorithm and also features an extremely fast decoder.
> > > 
> > > Kernel Decompression APIs are based on implementation by Yann Collet
> > > (http://code.google.com/p/lz4/source/checkout).
> > > De/compression Tools are also provided from the site above.
> > > 
> > > The initial test result on ARM(v7) based board shows that the size of 
> > > kernel
> > > with LZ4 compressed is 8% bigger than LZO compressed  but the 
> > > decompressing
> > > speed is faster(especially under the enabled unaligned memory access).
> > > 
> > > Test: 3.4 based kernel built with many modules
> > > Uncompressed kernel size: 13MB
> > > lzo: 6.3MB, 301ms
> > > lz4: 6.8MB, 251ms(167ms, with enabled unaligned memory access)
> > 
> > What's this "with enabled unaligned memory access" thing?  You mean "if
> > the arch supports CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS"?  If so,
> > that's only x86, which isn't really in the target market for this
> > patch, yes?
> 
> I'm guessing this is referring to commit 5010192d5a.
> 
> > It's a lot of code for a 50ms boot-time improvement.  Does anyone have
> > any opinions on whether or not the benefits are worth the cost?
> 
> Well, we used to have only one compressed format.  Now we have nearly 
> half a dozen, with the same worthiness issue between themselves.  
> Either we keep it very simple, or we make it very flexible.  The former 
> would argue in favor of removing some of the existing formats, the later 
> would let this new format in.

This reminded me to check the status of the lzo update and it
seems it got lost?
http://lkml.org/lkml/2012/10/3/144

(Cc: added, I hope Markus still cares and someone could
eventually take his patch once he resends it.)

Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL v2] Update LZO compression

2012-08-22 Thread Johannes Stezenbach
On Tue, Aug 21, 2012 at 05:21:50PM +0200, Markus F.X.J. Oberhumer wrote:
> as suggested on the mailing list I have converted the updated LZO
> code into git, so please pull my "lzo-update" branch from
...
> [ Changes in v2: Optimize code for CPUs with inefficient unaligned
>   access => significant speed increase on ARM ]

I can confirm that this new code runs at the same speed
as the current lzo code in the Linux kernel on
my ARM926EJ-S based platform.  I only tested decompression,
using the attached hacky userspace code.

   # time ./lzo-bench/old/unlzop /dev/null
   real0m 0.29s
   # time ./lzo-bench/new/unlzop /dev/null
   real0m 0.29s

   (where lzoimage is a Linux Image compressed with lzop)

So, from my side there are no more objections.
Thanks for doing this work, Markus.


Johannes


lzo-bench.tar.gz
Description: Binary data


Re: [GIT PULL] Update LZO compression

2012-08-16 Thread Johannes Stezenbach
On Thu, Aug 16, 2012 at 12:48:49PM -0400, Jeff Garzik wrote:
> On 08/16/2012 12:20 PM, Andi Kleen wrote:
> >>If you think a little bit, I bet you could come up with a solution that
> >>operates at cacheline-aligned granularity, something that would be _even
> >>faster_ than simply fixing the code to do aligned accesses.
> >
> >Cache aligned compression is unlikely to compress anything at all.
> >Compression algorithms are usually by definition unaligned.
> 
> Sure it's a bitstream, but that does not imply the impossibility of
> reading data in in an word-aligned manner.
> 
> Maybe cache-aligned is ambitious, because of resultant code bloat,
> but machine-int-aligned is doable and reasonable.

Well, I for one would be content if the old and new lzo versions
could be merged based on CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS.

(Assuming that the slowdown on ARM is due to unaligned access,
since the old version also uses get/put_unaligned, is the new
version actually using more unaligned accesses?)


Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] Update LZO compression

2012-08-16 Thread Johannes Stezenbach
On Thu, Aug 16, 2012 at 08:27:15AM +0200, Markus F.X.J. Oberhumer wrote:
> On 2012-08-15 16:45, Johannes Stezenbach wrote:
> > 
> > I made the attached quick hack userspace code
> > using ARM kernel headers and barebox unlzop code.
> > (new == your new code, old == linux-3.5 git, test == new + your suggested 
> > change)
> > (sorry I had no time to clean it up)
> 
> My suggested COPY4 replacement probably has a lot of load stalls - maybe some
> ARM expert could have a look and suggest a more efficient implementation.
> 
> In any case, I still would like to see the new code in linux-next because
> of the huge improvements on other modern CPUs.

Well, ~2x speedup on x86 is certainly a good achievement, but there
are more ARM based devices than there are PCs, and I guess many
embedded devices use lzo compressed kernels and file systems
while I'm not convinced many PCs rely on lzo in the kernel.

I know everyone's either busy or on vacation, but it would
be so cool if someone could test on a more modern ARM core,
with the userspace test code I posted it should be easy to do.


Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: DT GPIO numbering?

2012-08-14 Thread Johannes Stezenbach
On Tue, Aug 14, 2012 at 12:00:23PM +0200, Linus Walleij wrote:
> On Fri, Aug 10, 2012 at 11:34 AM, Johannes Stezenbach  wrote:
> 
> > Actually I think the kernel internal GPIO numbers shouldn't be in the
> > sysfs API, instead userspace should use the names.
> 
> This is true, but we cannot remove these numbers because they
> are now in Documentation/ABI/testing/sysfs-gpio
> 
> And while the "testing" ABI is, well for testing, it would probably
> break a lot of stuff it we removed it.
> 
> But we can sure add names. However these would still sit under
> /sys/class/gpio/gpioN/name
> 
> Or do you suggest we simply duplicate all GPIOs which have
> names under /sys/class/gpio/named/
> or something like that?

I'm still not sure.  One idea was to add /proc/gpios which maps
names to numbers, then userspace can look up the number and use that.
But the more I think about it /sys/class/gpio/export is just
a debug hack and shouldn't be used.  Board code should export
the available gpio according to pinctrl setup and schematics.
The only catch here is that board code then needs to know which gpio are
for userspace and which are used by in-kernel drivers.
E.g. a LED could be set by LED Triggers or by userspace
Blinkenlight app.


Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] Update LZO compression

2012-08-14 Thread Johannes Stezenbach
On Tue, Aug 14, 2012 at 01:44:02AM +0200, Markus F.X.J. Oberhumer wrote:
> On 2012-07-16 20:30, Markus F.X.J. Oberhumer wrote:
> >
> > As stated in the README this version is significantly faster (typically more
> > than 2 times faster!) than the current version, has been thoroughly tested 
> > on
> > x86_64/i386/powerpc platforms and is intended to get included into the
> > official Linux 3.6 or 3.7 release.
> >
> > I encourage all compression users to test and benchmark this new version,
> > and I also would ask some official LZO maintainer to convert the updated
> > source files into a GIT commit and possibly push it to Linus or linux-next.

Sorry for not reporting earlier, but I didn't have time to do real
benchmarks, just a quick test on ARM926EJ-S using barebox,
and found in the new version decompression is slower:
http://lists.infradead.org/pipermail/barebox/2012-July/008268.html

BTW, do you have userspace code matching the old and new
lzo versions?  It would be easier to benchmark.

Unfortunately I cannot claim high confidence in my benchmark results
due to missing time to do it properly, it would be useful if
someone else could do some benchmarks on ARM before merging this.


Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: DT GPIO numbering?

2012-08-10 Thread Johannes Stezenbach
On Mon, Aug 06, 2012 at 07:10:00PM +0800, Mitch Bradley wrote:
> On 8/6/2012 5:58 PM, Johannes Stezenbach wrote:
> > On Mon, Aug 06, 2012 at 08:35:51AM +0200, Linus Walleij wrote:
> >> On Mon, Aug 6, 2012 at 4:18 AM, Stephen Warren  
> >> wrote:
> >>
> >>> I can't comment on the sysfs-vs-dev interface location, but I don't
> >>> think it addresses Johannes' issue; finding out which GPIO IDs are
> >>> provided by which devices.
> >>>
> >>> Perhaps in each device's sysfs node, there should be some information
> >>> re: which GPIO range it provides. Right now, perhaps a text file with
> >>> the GPIO base it it.
> >>
> >> Yes that could work ...
> > 
> > The method used by the gpio-mxs.c driver (of_alias_get_id)
> > would also work.  The question is which method is preferable.
> > 
> > Ideally I would like to use DT attributes to identify my GPIOs
> > in the same way as they appear in the schematics.  E.g.
> > one device may have GPIOs called PORT_A.0 to PORT_A.7,
> > another one may be EXT.0 to EXT.15.  But a single integer ID
> > is good enough since GPIO usage is platform specific anyway.
> > However, the mapping must be static and not depend e.g. on
> > module load order like now if you use pl061 and some i2c GPIO.
> > Software must be able to rely on that e.g. GPIO ID 11
> > always refers to EXT.3.
> 
> There is precedence for a "slot-names" property that correlates specific
> hardware entities with physical labels.  It has been applied to PCI
> plug-in slots and to other devices.  See, for example,
> http://www.openfirmware.org/1275/proposals/Closed/Accepted/381-it.txt

Sorry about the slow response.  After thinking it through I decided
that a) adding ad-hoc DT bindings isn't good, and b) doing
it properly is above my head atm (I have too many other tasks to
take care of).  So I decided to use platform data to get stable
GPIO numbers and names for now.

Actually I think the kernel internal GPIO numbers shouldn't be in the
sysfs API, instead userspace should use the names.  Probably it's
best to not use /sys/class/gpio/export but instead let the board
init code export the GPIOs available to userspace with proper names.
Not sure yet...


Thanks,
Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: DT GPIO numbering?

2012-08-06 Thread Johannes Stezenbach
On Mon, Aug 06, 2012 at 08:35:51AM +0200, Linus Walleij wrote:
> On Mon, Aug 6, 2012 at 4:18 AM, Stephen Warren  wrote:
> 
> > I can't comment on the sysfs-vs-dev interface location, but I don't
> > think it addresses Johannes' issue; finding out which GPIO IDs are
> > provided by which devices.
> >
> > Perhaps in each device's sysfs node, there should be some information
> > re: which GPIO range it provides. Right now, perhaps a text file with
> > the GPIO base it it.
> 
> Yes that could work ...

The method used by the gpio-mxs.c driver (of_alias_get_id)
would also work.  The question is which method is preferable.

Ideally I would like to use DT attributes to identify my GPIOs
in the same way as they appear in the schematics.  E.g.
one device may have GPIOs called PORT_A.0 to PORT_A.7,
another one may be EXT.0 to EXT.15.  But a single integer ID
is good enough since GPIO usage is platform specific anyway.
However, the mapping must be static and not depend e.g. on
module load order like now if you use pl061 and some i2c GPIO.
Software must be able to rely on that e.g. GPIO ID 11
always refers to EXT.3.


> > With the new /dev interface you mention above,
> > perhaps a symlink to the /dev file, or a file containing the /dev file's
> > major/minor number. Or, is there such a thing already (other than
> > debugfs's gpio file).
> 
> Nothing I know of, but yes the day we come up with something,
> it needs to be backward-compatible some way.
> 
> The problem is that there is really no reference userspace
> like "lsgpio" or so. Maybe the first step could be to create that.

I don't know much about OpenWrt, but I've seen they have
something:
https://dev.openwrt.org/browser/trunk/target/linux/generic/files/drivers/char/gpio_dev.c
https://dev.openwrt.org/browser/trunk/target/linux/generic/files/include/linux/gpio_dev.h
https://dev.openwrt.org/browser/trunk/package/gpioctl/src/main.c


Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


DT GPIO numbering?

2012-08-01 Thread Johannes Stezenbach
Hi,

I'm currently learning how Linux devicetree support works,
here is one question I couldn't find an answer for.

I understand that within the devicetree GPIOs are referenced by phandle,
thus the numbers are irrelevant.  However, in sysfs the number is
what is used to access the GPIO, e.g. for debugging or
blinkenlight apps.  How does this fit together?

In the old days platform data was used, e.g.

struct pl061_platform_data {
/* number of the first GPIO */
unsignedgpio_base;
...
};

Now, when DT is used gpio-pl061.c sets gc.base = -1 (dynamic numbering).

Should there be a DT property to assign the number base?

Or is there some better way, e.g. in gpio-mxs.c the code derives
the gc.base from of_alias_get_id(np, "gpio").
Should gpio-pl061.c do the same?

And how about assigning gpio names?  When a name is assigned to
the GPIO, is shows up in sysfs instead of gpio%d, however the
number is still needed for /sys/class/gpio/export, right?


Thanks,
Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [build bug, 2.6.24-rc1] CONFIG_VIDEO_DEV=m & CONFIG_VIDEO_SAA7146_VV=y

2007-10-29 Thread Johannes Stezenbach
On Mon, Oct 29, 2007, Ingo Molnar wrote:
> * Randy Dunlap <[EMAIL PROTECTED]> wrote:
> 
> > > config VIDEO_SAA7146_VV
> > >   tristate
> > >   depends on VIDEO_DEV = y || VIDEO_DEV = VIDEO_SAA7146_VV
> > >   select VIDEOBUF_DMA_SG
> > >   select VIDEO_SAA7146
> > > 
> > > (untested)
> > 
> > Nope, won't work.  I tried that last night.  VIDEO_DEV_SAA7146_VV
> > has too many "select"s involved, but select doesn't follow the dependency
> > chains.  IOW, as written in Documentation/kbuild/kconfig-language.txt:
> > 
> > select is evil select will by brute force set a symbol
> > equal to 'y' without visiting the dependencies. So abusing
> > select you are able to select a symbol FOO even if FOO depends
> > on BAR that is not set.
> 
> so ... what should we do? Remove those ~7 select VIDEO_SAA7146_VV lines 
> and replace them with depends on VIDEO_SAA7146_VV ?

Hm, the idea is that the SAA7146 driver is like a library,
and the V4L or DVB card drivers select the library functions
they need (base driver or common V4L helper functions).
The user shouldn't have to worry about those details.

But yeah, if it's not possible to do that with kbuild then
it's probably best to s/select/depends on/ for VIDEO_SAA7146_VV
and provide a meaningful help text for VIDEO_SAA7146_VV.


Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [build bug, 2.6.24-rc1] CONFIG_VIDEO_DEV=m & CONFIG_VIDEO_SAA7146_VV=y

2007-10-27 Thread Johannes Stezenbach
On Fri, Oct 26, 2007, Ingo Molnar wrote:
> 
> the attached config (generated via make randconfig) fails to build due 
> to the combination of these config entries:
> 
>   CONFIG_VIDEO_DEV=m
>   CONFIG_VIDEO_SAA7146_VV=y
> 
> i found no obvious Kconfig way to force VIDEO_SAA7146_VV to be modular 
> when VIDEO_DEV is modular - is there a good solution for this?

According to http://lkml.org/lkml/2007/10/21/226 :

config VIDEO_SAA7146_VV
tristate
depends on VIDEO_DEV = y || VIDEO_DEV = VIDEO_SAA7146_VV
select VIDEOBUF_DMA_SG
select VIDEO_SAA7146

(untested)


Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [v4l-dvb-maintainer] [GIT PATCHES] V4L/DVB changes for 2.6.24

2007-10-14 Thread Johannes Stezenbach
On Sun, Oct 14, 2007, Markus Rechberger wrote:
> 
> the reason why I take the em28xx as hostage is, well I started with it
> and I work with that company and I don't see a way how to implement
> the latest devices without terrible hacks (and there are around 60
> devices supported only by the current available driver and it will
> double that number since customers will change several chips on those
> boards)
...
> I pulled all my linux opensource projects offline till this is cleared
> up I don't want to do 90% of all work and people taking over my
> project doing 10% of hacks for getting some credits. The long time
> support is not related to linux only.

It is a bit naive for you to believe you can remove your GPL
distributed work from the internet by deleting it from your server.

If your kernel driver work would be merged into the kernel it
would retain your copyrights and Signed-off-by: attributions,
so it would be visible for everyone that it is your work. If
you can't live with that, then why on earth did you join a
project developing software released under the GPL? Why did
you release your own software under the GPL?

Since you seem obsessed with keeping control over your
work it is funny that you mention BSD, as the BSD license
is even less restrictive than the GPL.


Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [linux-dvb] [PATCH] Userspace tuner

2007-09-15 Thread Johannes Stezenbach
On Sat, Sep 15, 2007, Markus Rechberger wrote:
> The main discussion in this thread was about drivers in userspace
> are bad because the API will allow binary drivers. The guy
> who works for Hauppauge (again I also have good contacts
> at Hauppauge Europe) writes it's bad - for no technical reason.

It sends a shiver down my spine that seem to imply that you
use your Hauppauge Europe contact to lobby against the
efforts of Hauppauge USA employees to promote support for
Open Source kernel drivers within their company.

> If someone points out that it is bad (after reading the whole thread)
> why don't we put X.org, bash, well everything into the kernel?
> GPL is the saviour seems to be the saviour for some people in this
> world, but in the end it's still if people want to go that way.
> Much work has been done by other people before, my work
> is also just an additional contribution and I (again) don't intend to
> release binary drivers. (also keep in mind that ubuntu takes
> everything which makes things work - this matters to the enduser)
> 
> Hey I can also write I can help you to get things right with some other
> people, and I can financially support people by giving away
> hardware and even specs for free in some cases. Who is able
> to do that from the old crufted v4l/dvb guys?
> 
> Manu throws his drivers over the wall to the OSS community, although
> I don't mind.
> Mauro is copying the logic of my code and writes I told him I'm ok with
> taking my code without just adding a single line of how his driver
> got developed. (I still wonder why he skipped some significant parts
> of the driver .. because he used the existing one as logic template)
> 
> http://linuxtv.org/hg/~mchehab/tm6000-new/log/14352ab89146/linux/drivers/media/video/tuner-xc2028.c
> (not looking at the specific changeset but he copied the firmware
> loading instructions without taking care about the copyright?)

After you dismissed all arguments except your own as invalid, you've
now moved on to the "post bullshit and personal accusations" stage.
I hope this means we're now done with this "discussion".

> > Now, doesn't _that_ get you thinking?
> 
> oh yes.

Yeah, right.


Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [linux-dvb] [PATCH] Userspace tuner

2007-09-15 Thread Johannes Stezenbach
On Sat, Sep 15, 2007, Markus Rechberger wrote:
> 
> it gets me thinking. Some core developers who I met during
> the last few weeks (kernel summit, suse conference in czech)
> told me to go on with it actually because the final plan isn't that
> bad..

I was referring to your code you posted for merging on linux-dvb,
and which got rejected. Anyway, it's easy to agree with you if one
has just heard _your_ version -- the purpose of this thread is to
give people an alternate version of the story to complement
yours, which would allow the people you talked to to think it over
and change their mind. See if you can get of those people you
talked to to post here to support you.

> Beside that I'm just curious how much did you contribute
> during the last 2 years to the lkml/linux kernel, and how much
> do you want to contribute in future? (also from my side
> talk is cheap (even for me) but getting something done costs
> quite some time and feedback from other people)

IOW you say if I don't write code I should shut up?
Is that also what you tell users on your em28xx list
when they dare to disagree with you?

Nice...


Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [linux-dvb] [PATCH] Userspace tuner

2007-09-14 Thread Johannes Stezenbach
On Fri, Sep 14, 2007, Markus Rechberger wrote:
> 
> people do contribute to the em28xx project.
...
> there's also an active and even problem solving oriented ML available:
> http://mcentral.de/pipermail/em28xx/
> 
> Also if you look at the mercurial code you'll see several people
> contributing to that project.

Of course, people who own such a device and want to use
it with Linux have no choice but to work with you.
And you do a good job for your users, you support them
well and in return they contribute info and patches
to support new devices.

But the thing is that at mcentral.de you're the man at the top,
and your users will hardly disagree with you on core
technical questions. (Well, admittedly I'm speculating
here as I don't read your em28xx list.)

On for drivers/media/ OTOH you are just one developer among others,
and some of them choose to disagree with you. Even worse,
IIRC there wasn't even _a single_ other developer willing
to ACK your offending patch.

Now, doesn't _that_ get you thinking?


Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [linux-dvb] [PATCH] Userspace tuner

2007-09-14 Thread Johannes Stezenbach
On Fri, Sep 14, 2007, Markus Rechberger wrote:
> On 9/14/07, Steven Toth <[EMAIL PROTECTED]> wrote:
> >
> > If you care about LinuxTV you'll work with the core subsystem developers
> > to bring your em28xx tree inline. If you don't care then why are you here?
> 
> It doesn't really work out to work with those 3-5 "core" people who are active
> there.
> It starts at the point where RFCs are submitted and not answered,
> discussions are avoided and finally some people start to complain.
> In case of pointing people to wrong or bad solutions, one "Maintainer"
> pointed out it would be like manipulating others work ... this exactly
> happened with the em28xx project. It's not only about the current
> implementation, as from my side I also take upcoming products into
> account and how long it would take to get something which isn't
> supported by the API fixed.. it's just something that is too hard and
> I don't want to debate about things where I know that the outcome
> is that I have to wait till someone of those 3-5 "core" people come up
> with an own idea.

Maybe you still don't realize how tiresome it is to talk to you.
What you present as "linuxtv people block my contributions" is
IMHO "linuxtv people got fed up talking to you". Because when
people disagree with you, you keep rambling on and on instead
of just accepting it. See, working with an Open source community
requires that you don't piss everyone off, but instead find
ways to _motivate_ them to help you fix the problems which
prevent your code from being merged. When people are doing
software development _for fun_, then it should be a _pleasure_
for them to work with you, and not a pain in the ass.

You code and your arguments in this discussion may be
different than before, but the thread follows a familiar
pattern and will likely go nowhere, just like the many
discussions before.


Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [linux-dvb] [PATCH] Userspace tuner

2007-09-13 Thread Johannes Stezenbach
On Thu, Sep 13, 2007, Markus Rechberger wrote:
> 
> We currently have an implementation that works, although
> it works by downloading several firmwares for several devices 
> or even several countries. This is not what I want to have in 
> future since it's not needed and it's also hard to manage for
> distributors. All those differences could be adjusted by 
> software even without module parameter hacks.

This argument doesn't hold water. The unpleasant point
for users and distributors isn't the "binary-only"
thing, it's the "no right to distribute" problem.
And that's the same for firmware blobs or binary-only
userspace blobs.

IOW, if you can get the right to redistribute a binary-only
userspace blob which incudes the firmware inside, why
shouldn't you be able to get the right to redistribute
just the firmware?

Or the other way round: Do you think your binary-only software
will be important enough so distributors will go through
all the trouble of trying to get a license to include it in
their distribution? If so, why wouldn't they do the same
for the plain firmware blobs for in-kernel drivers?


Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [linux-dvb] [PATCH] Userspace tuner

2007-09-13 Thread Johannes Stezenbach
On Thu, Sep 13, 2007, Markus Rechberger wrote:
> Let's add the LKML to this.
> 
> On 9/13/07, Markus Rechberger <[EMAIL PROTECTED]> wrote:
> > On 9/12/07, Mauro Carvalho Chehab <[EMAIL PROTECTED]> wrote:
> > > I don't see any technical reason why tuner drivers should be moved to
> > > userspace. Looking at xc3028 device, the driver is very simple and
> > > doesn't require any special treatment that it isn't possible to be done
> > > at kernel. There are already some implementations on kernelspace that
> > > works fine.
> >
> > As from my side to support the xceive driver properly it needs a
> > rewrite and a proper API description. Since it's not possible to
> > discuss any API changes

Not possible? We're doing it all the time...

However, your ideas were rejected in this discussion,
and you can't seem to get over it.

> > don't get me wrong but the existing community is rather small and
> > kicking off people who are interested in changing things.

IMHO there is a lack of openness caused by people being burned
in past flamewars. This makes it a bit difficult to see through
what happens and why, and to participate.  However, I think it
is completely wrong to say that the community is "kicking off people".

> > I'm against how the project works out at the moment and how it worked
> > out in history. Exactly this way will kick off companies to be
> > interested in future like Avermedia. A driver can easily be written
> > within a few weeks and I've been struggling with it for 2 years(!!!)
> > now just for nothing finally telling me that some guys want to steal
> > my code and move it to kernelspace although it would raise more
> > complications with upcoming and current devices which have even more
> > requirements.

Oh dear, there we go again... more flame bait...

I reality, 95% of your driver code could have been merged
without problems, but you refused to take the small, objectionable
part out of the picture.

(For those interested:
http://mcentral.de/~mrec/patches/v4l-dvb/hg_v4l-dvb-experimental_01.patch
The patch changed the internal tuner API and required changes
to all tuner drivers.)

Your all-or-nothing approach didn't work out.

Out of curiosity: How does your userspace approach solve
the hybrid (analog/digital TV) tuner problem which was the
only objectionable part of your work? And why are the kernel
parts of your new interface now less objectionable? What changed?


Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3

2007-06-19 Thread Johannes Stezenbach
On Tue, Jun 19, 2007, Manu Abraham wrote:
> Johannes Stezenbach wrote:
> 
> > I argue that if you keep the free loaders out, you miss
> > the chance to communicate with and educate them.
> > Communication across borders doesn't work well, and you create
> > a border between the morally "good" and the "bad".
> > 
> > Of course you can't expect that every free loader will
> > learn and accept the free software philosopy, some just
> > won't. But to me that's acceptable, and the GPLv2, or indeed
> > Linus' tit-for-tat interpretation of the GPLv2, is IMHO
> > sufficient to protect my interests.
> 
> Err .. when you say protection on one hand and on the other you state
> it's hard to keep free loaders away, 

I didn't say that.

IMHO it isn't even useful to try to keep free loaders away,
it's better to try and integrate them gradually. That's part
of the game.
(Where "free loaders" is a term introduced by Alexandre, not by me.)

The GPLv2 is a sufficient tool to defend free software
against those that don't even grasp tit-for-tat. But if
they do, you can talk to them *as peers* and try to convince
them that there's more to free software than just tit-for-tat.
But it has to be their decision, IMHO it's wrong to force them.

The GPLv3 tries to be a tool to defend against those that
don't subscribe to the full Free Software Definition.


Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3

2007-06-19 Thread Johannes Stezenbach
On Mon, Jun 18, 2007, Alexandre Oliva wrote:
> On Jun 18, 2007, Johannes Stezenbach <[EMAIL PROTECTED]> wrote:
> 
> > Hm, you only talk about people who already use free software,
> > but I tried to make you aware of the importance of
> > _promoting_ free software, i.e. winning new people and
> > companies for the free software idea.
> 
> Aah, I see.  Indeed, I'd missed that aspect.  Sorry about that.
> 
> My take on it is that bringing free loaders in doesn't help us much,
> and bringing them in in a way that they don't learn the essential
> aspects of the community will hurt the community in the long run.
> 
> So they must become aware that respecting others' freedoms is not only
> the right thing to do, from a moral and ethical standpoint, but also
> that this is precisely what enables our community to thrive, and to
> enable everyone to get the best out of the software we cooperate to
> develop.

The keywords here are "learn" and "become aware": It's a process
which takes time, and which requires ongoing communication.

I argue that if you keep the free loaders out, you miss
the chance to communicate with and educate them.
Communication across borders doesn't work well, and you create
a border between the morally "good" and the "bad".

Of course you can't expect that every free loader will
learn and accept the free software philosopy, some just
won't. But to me that's acceptable, and the GPLv2, or indeed
Linus' tit-for-tat interpretation of the GPLv2, is IMHO
sufficient to protect my interests.

> Of course we might get some additional contributions here and there,
> but then more and more users would still be stuck, unable or limited
> in the ways and incentives they have to participate in our community.
> Permitting this is very short-sighted.  It might bring us apparent
> advantages in the short run, but the more such disrespects there are,
> the more there will be, and the fewer users will be able to become
> developers.  In the end, this may kill the whole process, in a tragedy
> of the commons.  In the article linked below, I argue this very point,
> comparing how the demand for respecting users' freedoms is what keeps
> the free-loaders away and makes the GPL the most cost-effective
> license for software development, compared with permissive licenses
> and non-Free licenses.  The very same arguments apply to a comparison
> between a license that permits tivoization and one that doesn't,
> because the latter is more likely to have more contributors to share
> the load, and both equally reduce the likelihood of unmergeable forks.
> http://www.lsd.ic.unicamp.br/~oliva/papers/free-software/BMind.pdf

I'm not arguing about the GPL, especially not against the GPLv2.

What I'm concerned about is that the language you use trying to
promote the GPLv3 is IMHO anti-promotion of free software.

I believe executives don't read licenses. What they'll read is
the random article about "GPLv3 to outlaw tivoization",
"FSF wants to keep free loaders away" etc.

What is more likely, that they'll go to www.gnu.org to read
and absorb the GNU philosopy in order to become an accepted
member of the free software community, or that they'll decide to
stick with their proprietary RTOS then?


Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3

2007-06-18 Thread Johannes Stezenbach
On Mon, Jun 18, 2007, Alexandre Oliva wrote:
> 
> People talk a lot about TiVo here, but do they the faintest idea of
> how the conversations with TiVo are proceeding?  I thought so...

Oh, if you know something we don't, could you please fill us in?
And who was it who coined the "Tivoization" term, thus putting
TiVo into focus?

> So, you see, when people who oppose anti-tivoization measure the
> outcome for the community, they only look at the second possibility,
> assuming the vendor would immediately switch to some other software.
> As if that was easy for the vendor, and as if the software sucked so
> much that the vendor was just looking for a reason to switch.
> 
> But since the software is good, and moving to another software would
> be costly in various dimentions, the vendor has an incentive to stick
> with the software they have.

Hm, you only talk about people who already use free software,
but I tried to make you aware of the importance of
_promoting_ free software, i.e. winning new people and
companies for the free software idea.

I think the majority of embedded devices still run proprietary
RTOSes, and the majority of desktops still run Windows or Mac OS.
Don't you want to change that?

There are dozens of proprietary RTOSes, and along with
them dozens of proprietary toolchains, development environments
and trace/debug tools. Companies which worked in this field
for decades have invested money to create proprietary software
on top of them, and to train their staff to use them. Those companies
won't switch to Linux lightly. And it won't be a singular event,
but a process. They might start low, and maybe (hopefully) might
become well-playing free software contributors. But if you raise
the entry barrier too high, they won't get started at all.

OK, I don't have experience talking to big companies, but
I have talked to people working for smaller ones. They are
aware of the trend towards Linux, but are afraid that the
obligations of the GPL might be impractical for them.
Then they only have the choice to not use Linux, or to use
"creative workarounds".

It's true that what these companies do might have little direct benefit
for users buying their products, however the long term benefits of
getting the people in these companies exposed to free software ideas,
and in contact with the free software community, can only be
positive -- I think it's more important to spread the general
idea of free software into as many minds as possible than to
ensure that few follow the pure spirit of the FSF free software
definition in every detail.

> So you see, the picture of anti-tivozation is not as bleak as people
> try to frame it.  In fact, it's not bleak at all.  If one out of 10,
> maybe even 1 out of 100 vendors start respecting users' freedoms, when
> faced with anti-tivoization provisions, the community will already win
> big time, because each vendor is likely to have thousands of
> customers, some of which will use the freedoms to serve the goals of
> the community, in the very terms the community claims to care about.

Does this multiplicator also apply to new companies
which start using free software for their products?

I think the FSF strategy is suboptimal. The Linux
strategy works better for promoting free software.

In the end I want my devices to be open and hackable, too,
and I'm sure it will take an effort to convince companies
to open up. But I'm not convinced that the GPLv3 is a
step in the right direction towards that goal.


Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3

2007-06-18 Thread Johannes Stezenbach
On Sun, Jun 17, 2007, Alexandre Oliva wrote:
> 
> Serious, what's so hard to understand about:
> 
>   no tivoization => more users able to tinker their formerly-tivoized
>   computers => more users make useful modifications => more
>   contributions in kind
> 
> ?
> 
> Sure, there's a downside too:
> 
>   no tivoization => fewer contributions from manufacturers that demand
>   on tivoization
> 
> 
> My perception is that the first easily dominates the second, and so
> you are better off without tivoization.


You seem to focus on _preserving the four freedoms_, however
the FSF also has the goal of _promoting free software_.
This goal is even written down in the GPLv2 itself, in section 10.

I think those two goals are somewhat conflicting. If you want to
win people for free software, you need to make it easy for them
to accept your ideas. However, in order to make it easy you have to
make compromises wrt the four freedoms.


The FSF apparently has decided that they won't compromise on
the freedoms as stated in The Free Software Definition.
The message they send out is "if you don't agree to our ethical
principles, get lost."

OTOH Linus has decided he wants "world domination".
So he makes it easy for other people to join by saying
"if you know what tit-for-tat means, welcome."


On the surface this might look like two totally different goals.
But IMHO it's not so much the goal which is different, but
the _strategy_ to reach the goal. In the end the Linux
people also want truly free software, they just believe
they can get there without forcing people.

Honestly, I think Linus' strategy has been much more
successful so far than the FSF's. Of course there is no Linux
system without GNU software, that's not the point. But I
think without Linus' lenient interpretation of the GPLv2 there
would be much less people using free software than
there are today.


If you look at the lenght of this thread, don't you realize
that even when you talk to software developers on a mailing list
dealing with free software/open source, you have trouble
to get acceptance for your fundamentalistic view of the
ethical principles of free software?

And you haven't even started to talk to the business people,
executives and lawyers which you need to convince if you
want to make free software ubiquitous. "We have high ethical
standards" is something these people don't understand or
care about. "It's a bargain, you can use it for free and all you
have to do is give back your changes" is what might work
to win them.


The bottom line is that I think your perception is completely wrong.

For sure I would like to be able to change the software in my
TiVo, too, but when I look at the big picture then I think
it's more important to have free software in every device,
on every computer, and accept that a few "unfree" devices
along the way are a price worth to pay.


Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: thinkpad testers wanted (was Re: 2.6.22-rc[23]: blinking capslock led, stuck keys?)

2007-06-04 Thread Johannes Stezenbach
On Mon, Jun 04, 2007, Pavel Machek wrote:
> 
> > >> Hmm, in theory it could be triggering bugs in some buggy keyboard
> > >> controller. But then a
> > >>
> > >> while true ; do setleds +caps +numlock ; sleep 1 ; setleds -caps 
> > >> -numlock ; sleep 1 ; done
> > >>
> > >> should trigger it too.
> > >
> > >...and it does.
> > >
> > >[EMAIL PROTECTED]:~$ while true; do setleds +num; setleds -num; done
> > >Hm,m so thiis  iis  a teest of fkeyboarad behaviour  under lloadd.
> > >
> > >[EMAIL PROTECTED]:~$
> > >
> > >...but I'm not quite sure it is a buggy keyboard. It happens _way_ too
> > >often. Launch the line above and try to do some typing...
> > 
> > This used to work fine on my box last time I tried it (the switch
> > itself is offloaded to a keventd and shoud not get in the way) but
> > then they push all kind of ACPI/SMM crap together with KBC so who
> > knows... I should try it again when I get home.
> 
> Hmm, this needs to be ran from console (not X). Can someone with
> thinkpad try this?

I see the same thing with a 2.6.21 kernel on a T42p.


HTH,
Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] LZO de/compression support - take 6

2007-05-30 Thread Johannes Stezenbach
On Wed, May 30, 2007, Nitin Gupta wrote:
> 
> Again, all the original code has been retained _as-is_. Whatever was
> changed, has been mentioned in that detailed changelog that I post
> along with patch.

Just a general remark (I haven't been following this thread closely):

IMHO it would be _much_ better to merge the original code and
your changes as seperate patches. Then someone who
wants to review it later doesn't have to jump through all
the hoops of finding the original code himself to diff it
and see your changes.

Additionally, you should also split stylistic/cleanup
changes like "Reformatted the code to match general kernel style"
from functional changes like "use cpu_to_le16()".

Ideally each of the changes you mention in your
"Changelog vs. original LZO" should be a seperate
patch, this would make review much easier.


Regards,
Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Long delay in resume from RAM (Was Re: [patch 00/69] -stablereview)

2007-05-24 Thread Johannes Stezenbach
On Thu, May 24, 2007 at 11:51:53PM +0200, Romano Giannetti wrote:
> On Thu, 2007-05-24 at 23:12 +0200, Sam Ravnborg wrote:
> 
> > 
> > I really cannot see why it makes a difference.
> > If you use += (and :=) make will resolve EXTRA_CFLAGS when it see it.
> > Whereas with = make will resolve it only when actually referenced.
> > 
> > But the way we use EXTRA_CFLAGS it should not matter.
> > If the fix above really helps nfs I need to take a closer look tomorrow.
> 
> No, you're right, it doesn't help. What could help is a form of saying
> to make "add this EXTRA_CFLAGS  to whatever is specified in the command
> line". No idea if it exists.

The GNU make manual says:

"To append more text to a variable defined on the command line, use:

 override VARIABLE += MORE TEXT
"


HTH,
Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] "volatile considered harmful", take 2

2007-05-11 Thread Johannes Stezenbach
On Fri, May 11, 2007 at 02:08:54AM +0530, jimmy bahuleyan wrote:
> Jonathan Corbet wrote:
> [snip..]
> > +
> > +  - The jiffies variable is special in that it can have a different value
> > +every time it is referenced, but it can be read without any special
> > +locking.  So jiffies can be volatile, but the addition of other
> > +variables of this type is strongly frowned upon.  Jiffies is considered
> > +to be a "stupid legacy" issue in this regard.
> 
> Why is it that you consider jiffies to be a "stupid legacy"? Isn't it
> natural to have a externally modified variable which is only /read/ to
> be volatile? (or is jiffies supposed to be replaced with something
> smarter/better :)

"stupid legacy" were Linus' words. http://lwn.net/Articles/233482/

How about this:

"The jiffies variable is a special case because there are too
many places in the kernel which would have to be changed and reviewed
if the volatile would be removed from jiffies. However, the
use of volatile qualifier for jiffies is just as wrong as
it is elsewhere. Don't use jiffies as an excuse to use volatile
in your code."


Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC/PATCH] doc: volatile considered evil

2007-05-09 Thread Johannes Stezenbach
On Tue, May 08, 2007, Jonathan Corbet wrote:
> 
> I just took a shot at turning this into something more like a normal
> document:
> 
>   http://lwn.net/Articles/233479/

I think the "jiffies variable is special" part misses the
"for stupid legacy reasons" explanation.

According to the other volatile rules one should use
something like that:

extern unsigned long __jiffies;
static inline unsigned long read_ulong(unsigned long *addr)
{
return *(volatile unsigned long *)addr;
}
static inline unsigned long get_jiffies(void)
{
return read_ulong(&__jiffies);
}

But of course changing all references to jiffies in the kernel would
be insane, thus jiffies is special "for stupid legacy reasons".

Right?


Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch] CFS scheduler, -v8

2007-05-08 Thread Johannes Stezenbach
On Tue, May 08, 2007, Esben Nielsen wrote:
> 
> This is contrary to C99 standeard annex H2.2 
> (http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf):
> 
> "An implementation that defines signed integer types as also being modulo 
> need
> not detect integer overflow, in which case, only integer divide-by-zero need
> be detected."
> 
> So if it doesn't properly defines wrapping it has to detect integer 
> overflow, right?

No. Annex H (informative!) only talks about LIA-1 conformance.

C99 isn't LIA-1 conformant. H2.2 describes what an implementation
might do to make signed integers LIA-1 compatible, which is
what gcc does with -fwarpv or -ftrapv.

At least that's how I understand it, the C99 standard
seems to have been written with the "it was hard to
write, so it should be hard to read" mindset. :-/

I still don't know _why_ signed integer overflow behaviour
isn't defined in C. It just goes against everyones expectation
and thus causes bugs.


Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch] CFS scheduler, -v8

2007-05-07 Thread Johannes Stezenbach
On Mon, May 07, 2007, Linus Torvalds wrote:
> On Mon, 7 May 2007, Esben Nielsen wrote:
> > 
> > What is (long)(a-b) ? I have tried to look it up in the C99 standeard but I
> > can't find it. Maybe it is in the referred LIA-1 standeard, which I can't 
> > find
> > with google.

C99 defines unsigned overflow semantics, but it doesn't say anything
about signed overflow, thus it's undefined -- and you have a hard
time finding it out.

However, I have no clue *why* it's undefined and not
implementation defined. Does someone know?

> I don't worry about non-2's-complement machines (they don't exist, and 
> likely won't exist in the future either).

I think DSPs can do saturated arithmetics (clamp to min/max
values instead of wrap around). Not that it matters for Linux...

> So I worry about compilers rewriting my code.

gcc has -fwrapv and -ftrapv to change signed integer overflow
behaviour.

One baffling example where gcc rewrites code is when
conditionals depend on signed integer overflow:

$ cat xx.c
#include 

int foo(int a)
{
assert(a + 100 > a);
return a;
}

int bar(int a)
{
if (a + 100 > a)
a += 100;
return a;
}
$ gcc -Wall -Wextra -fomit-frame-pointer -c xx.c
$ objdump -dr xx.o

xx.o: file format elf32-i386

Disassembly of section .text:

 :
   0:   8b 44 24 04 mov0x4(%esp),%eax
   4:   c3  ret

0005 :
   5:   83 44 24 04 64  addl   $0x64,0x4(%esp)
   a:   8b 44 24 04 mov0x4(%esp),%eax
   e:   c3  ret


The assert and the condition were just dropped
by gcc -- without any warning.

gcc-4.2 will add -fstrict-overflow and -Wstrict-overflow.
http://gcc.gnu.org/gcc-4.2/changes.html


Johannes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   >