Skip to contentSkip to conversation

arch/tile: new multi-core architecture for Linux

PATCH In review Chris Metcalf 13 participants 109 messages May 20, 2010 – May 27, 2011 3 messages not in the archive Page 1 of 2

Subsystems (21)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch/tile: new multi-core architecture for Linux

At Tilera we have been running Linux 2.6.26 on our architecture for a while and distributing the sources to our customers. We just sync'ed up our sources to 2.6.34 and would like to return it to the community more widely, so I'm hoping to take advantage of the merge window for 2.6.35 to integrate support for our architecture.

The "tile" architecture supports the Tilera chips, both our current 32-bit chips and our upcoming 64-bit architecture. The chips are multicore, with 64 (or 36) cores per chip on our current product line, and up to 100 cores on the upcoming 64-bit architecture. They also include multiple built-in memory controllers, 10 Gb Ethernet, PCIe, and a number of other I/Os. There's more info at http://www.tilera.com.

The architecture is somewhat MIPS-like, but VLIW, with up to three instructions per bundle. The system architecture is nicely orthogonal, with four privilege levels that can be assigned to each of forty-odd separate protection domains, many with an associated interrupt, e.g. ITLB/DTLB misses, timer, performance counters, various interrupts associated with the generic networks that connect the cores, etc. A hypervisor (kind of like the Alpha PAL) runs at a higher privilege level to support Linux via software-interrupt calls.

The Linux we ship has some additional performance and functionality customization in the generic code, but appended is the patch that just adds the minimum amount of functionality into the platform-independent code to hook in the tile architecture code in arch/tile. We will attempt to push the other changes to the platform-independent code piece by piece, after the initial architecture support is in. We will also push up the 64-bit TILE-Gx support once that architecture is fully frozen (e.g. instruction encodings finalized).

We are using the http://www.tilera.com/scm/ web site to push Tilera-modified sources back up to the community. At the moment, the arch/tile hierarchy is there (as a bzipped tarball) as well as a copy of the patch appended to this email. In addition, our gcc, binutils, and gdb sources are available on the web site. We have not yet started the community return process for gcc, binutils, and gdb, so they are in a preliminary form at this point.

The git://www.tilera.com server is up, but without content yet, since we realized this week that we need to upgrade the web server to a 64-bit kernel to support a decent git server, so though we plan to make the code available via git in the future, it isn't yet.

As far as the platform-independent changes go, two of the changes in the appended patch are uncontroversial, one adding a stanza to MAINTAINERS, and one adding a line to drivers/pci/Makefile to request "setup-bus.o setup-irq.o" for tile PCI.

A slightly more interesting one-line change is to <linux/mm.h>, to support lowmem PAs above the 4GB limit. We use NUMA to manage the multiple memory controllers attached to the chip, and map some of each controller into kernel LOWMEM to load-balance memory bandwidth for kernel-intensive apps. The controllers can each manage up to 16GB, so we use bits above the 4GB limit in the PA to indicate the controller number. It turns out that generic Linux almost tolerates this, but requires one cast in lowmem_page_address() to avoid shifting the high PA bits out of a 32-bit PFN type.

The final change is just a PCI quirk for our TILEmpower platform, which explains itself in the comment. This is not a critical change from our point of view, but without it you can't use the SATA disks attached to the PCI controller on that platform, so we're hoping it can be accepted as part of the initial tile architecture submission as well.

I'd appreciate being cc'ed on any comments on the patch or the tile architecture support, since although I try to follow LKML, the volume can be somewhat overwhelming.

MAINTAINERS +6 -0
@@ -5436,6 +5436,12 @@
 S:	Maintained
 F:	sound/soc/codecs/twl4030*
 
+TILE ARCHITECTURE
+M:	Chris Metcalf <[email protected]>
+W:	http://www.tilera.com/scm/
+S:	Supported
+F:	arch/tile/
+
 TIPC NETWORK LAYER
 M:	Jon Maloy <[email protected]>
 M:	Allan Stephens <[email protected]>
include/linux/mm.h +1 -1
@@ -592,7 +592,7 @@
 
 static __always_inline void *lowmem_page_address(struct page *page)
 {
-	return __va(page_to_pfn(page) << PAGE_SHIFT);
+	return __va((phys_addr_t)page_to_pfn(page) << PAGE_SHIFT);
 }
 
 #if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL)
drivers/pci/Makefile +1 -0
@@ -49,6 +49,7 @@
 obj-$(CONFIG_X86_VISWS) += setup-irq.o
 obj-$(CONFIG_MN10300) += setup-bus.o
 obj-$(CONFIG_MICROBLAZE) += setup-bus.o
+obj-$(CONFIG_TILE) += setup-bus.o setup-irq.o
 
 #
 # ACPI Related PCI FW Functions
drivers/pci/quirks.c +17 -0
@@ -2094,6 +2094,23 @@
 			quirk_unhide_mch_dev6);
 
 
+/*
+ * The Tilera Blade V1.0 platform needs to set the link speed
+ * to 2.5GT(Giga-Transfers)/s (Gen 1). The default link speed
+ * setting is 5GT/s (Gen 2). 0x98 is the Link Control2 PCIe
+ * capability register of the PEX8624 PCIe switch. The switch
+ * supports link speed auto negotiation. This is expected to
+ * be fixed in the next release of the Blade platform.
+ */
+static void __devinit quirk_tile_blade(struct pci_dev *dev)
+{
+	if (blade_pci) {
+		pci_write_config_dword(dev, 0x98, 0x1);
+		mdelay(50);
+	}
+}
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8624, quirk_tile_blade);
+
 #ifdef CONFIG_PCI_MSI
 /* Some chipsets do not support MSI. We cannot easily rely on setting
  * PCI_BUS_FLAGS_NO_MSI in its bus flags because there are actually
#1 lore raw
Quoted 88 lines · Chris Metcalf

At Tilera we have been running Linux 2.6.26 on our architecture for a while and distributing the sources to our customers.  We just sync'ed up our sources to 2.6.34 and would like to return it to the community more widely, so I'm hoping to take advantage of the merge window for 2.6.35 to integrate support for our architecture.

The "tile" architecture supports the Tilera chips, both our current 32-bit chips and our upcoming 64-bit architecture.  The chips are multicore, with 64 (or 36) cores per chip on our current product line, and up to 100 cores on the upcoming 64-bit architecture.  They also include multiple built-in memory controllers, 10 Gb Ethernet, PCIe, and a number of other I/Os.  There's more info at http://www.tilera.com.

The architecture is somewhat MIPS-like, but VLIW, with up to three instructions per bundle.  The system architecture is nicely orthogonal, with four privilege levels that can be assigned to each of forty-odd separate protection domains, many with an associated interrupt, e.g. ITLB/DTLB misses, timer, performance counters, various interrupts associated with the generic networks that connect the cores, etc. A hypervisor (kind of like the Alpha PAL) runs at a higher privilege level to support Linux via software-interrupt calls.

The Linux we ship has some additional performance and functionality customization in the generic code, but appended is the patch that just adds the minimum amount of functionality into the platform-independent code to hook in the tile architecture code in arch/tile.  We will attempt to push the other changes to the platform-independent code piece by piece, after the initial architecture support is in. We will also push up the 64-bit TILE-Gx support once that architecture is fully frozen (e.g. instruction encodings finalized).

We are using the http://www.tilera.com/scm/ web site to push Tilera-modified sources back up to the community.  At the moment, the arch/tile hierarchy is there (as a bzipped tarball) as well as a copy of the patch appended to this email.  In addition, our gcc, binutils, and gdb sources are available on the web site.  We have not yet started the community return process for gcc, binutils, and gdb, so they are in a preliminary form at this point.

The git://www.tilera.com server is up, but without content yet, since we realized this week that we need to upgrade the web server to a 64-bit kernel to support a decent git server, so though we plan to make the code available via git in the future, it isn't yet.

As far as the platform-independent changes go, two of the changes in the appended patch are uncontroversial, one adding a stanza to MAINTAINERS, and one adding a line to drivers/pci/Makefile to request "setup-bus.o setup-irq.o" for tile PCI.

A slightly more interesting one-line change is to <linux/mm.h>, to support lowmem PAs above the 4GB limit.  We use NUMA to manage the multiple memory controllers attached to the chip, and map some of each controller into kernel LOWMEM to load-balance memory bandwidth for kernel-intensive apps.  The controllers can each manage up to 16GB, so we use bits above the 4GB limit in the PA to indicate the controller number. It turns out that generic Linux almost tolerates this, but requires one cast in lowmem_page_address() to avoid shifting the high PA bits out of a 32-bit PFN type.

The final change is just a PCI quirk for our TILEmpower platform, which explains itself in the comment.  This is not a critical change from our point of view, but without it you can't use the SATA disks attached to the PCI controller on that platform, so we're hoping it can be accepted as part of the initial tile architecture submission as well.

I'd appreciate being cc'ed on any comments on the patch or the tile architecture support, since although I try to follow LKML, the volume can be somewhat overwhelming.

MAINTAINERS   2010-05-17 18:00:12.651112000 -0400 renamed from MAINTAINERS    2010-05-16 17:17:36.000000000 -0400 +0 -0
@@ -5436,6 +5436,12 @@

 S:     Maintained
 F:     sound/soc/codecs/twl4030*

MAINTAINERS   2010-05-17 18:00:12.651112000 -0400 renamed from MAINTAINERS    2010-05-16 17:17:36.000000000 -0400 +6 -0
+TILE ARCHITECTURE
+M:     Chris Metcalf <[email protected]>
+W:     http://www.tilera.com/scm/
+S:     Supported
+F:     arch/tile/
+

 TIPC NETWORK LAYER
 M:     Jon Maloy <[email protected]>
 M:     Allan Stephens <[email protected]>

include/linux/mm.h    2010-05-17 12:54:33.540145000 -0400 line 595

Quoted 5 lines
include/linux/mm.h    2010-05-17 12:54:33.540145000 -0400 renamed from include/linux/mm.h     2010-05-16 17:17:36.000000000 -0400 +1 -1
@@ -592,7 +592,7 @@
 
  static __always_inline void *lowmem_page_address(struct page *page)
  {
-       return __va(page_to_pfn(page) << PAGE_SHIFT);
+       return __va((phys_addr_t)page_to_pfn(page) << PAGE_SHIFT);

Here doesn't make sense. you give a u64 type cast, but change the meaning of pfn. Is pfn phys_addr_t? Anyway, page_to_pfn can be re-fulfilled in your arch, but not change it in common code.

Quoted 25 lines
include/linux/mm.h    2010-05-17 12:54:33.540145000 -0400 renamed from include/linux/mm.h     2010-05-16 17:17:36.000000000 -0400 +0 -0
  }
 
  #if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL)
drivers/pci/Makefile  2010-05-13 15:03:05.615238000 -0400 renamed from drivers/pci/Makefile   2010-05-09 21:36:28.000000000 -0400 +0 -0
@@ -49,6 +49,7 @@

 obj-$(CONFIG_X86_VISWS) += setup-irq.o
 obj-$(CONFIG_MN10300) += setup-bus.o
 obj-$(CONFIG_MICROBLAZE) += setup-bus.o
+obj-$(CONFIG_TILE) += setup-bus.o setup-irq.o

 #
 # ACPI Related PCI FW Functions

drivers/pci/quirks.c  2010-05-17 13:26:22.347178000 -0400 renamed from drivers/pci/quirks.c   2010-05-16 17:17:36.000000000 -0400 +6 -0
@@ -2094,6 +2094,23 @@
                        quirk_unhide_mch_dev6);
 
 
+/*
+ * The Tilera Blade V1.0 platform needs to set the link speed
+ * to 2.5GT(Giga-Transfers)/s (Gen 1). The default link speed
+ * setting is 5GT/s (Gen 2). 0x98 is the Link Control2 PCIe
+ * capability register of the PEX8624 PCIe switch. The switch
+ * supports link speed auto negotiation. This is expected to

drivers/pci/quirks.c  2010-05-17 13:26:22.347178000 -0400 line 2112

Quoted 10 lines
drivers/pci/quirks.c  2010-05-17 13:26:22.347178000 -0400 renamed from drivers/pci/quirks.c   2010-05-16 17:17:36.000000000 -0400 +10 -0
+ * be fixed in the next release of the Blade platform.
+ */
+static void __devinit quirk_tile_blade(struct pci_dev *dev)
+{
+       if (blade_pci) {
+               pci_write_config_dword(dev, 0x98, 0x1);
+               mdelay(50);
+       }
+}
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8624, quirk_tile_blade);

Your patch is not compilable, and the subject doesn't match well with the content. I think you need re-organize patches.

Quoted 10 lines
drivers/pci/quirks.c  2010-05-17 13:26:22.347178000 -0400 renamed from drivers/pci/quirks.c   2010-05-16 17:17:36.000000000 -0400 +1 -1
+
  #ifdef CONFIG_PCI_MSI
  /* Some chipsets do not support MSI. We cannot easily rely on setting
  * PCI_BUS_FLAGS_NO_MSI in its bus flags because there are actually
--

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/

#2 lore raw
Quoted 10 lines · Barry Song
Quoted 5 lines · Chris Metcalf

 static __always_inline void *lowmem_page_address(struct page *page) {
-       return __va(page_to_pfn(page) << PAGE_SHIFT);
+       return __va((phys_addr_t)page_to_pfn(page) << PAGE_SHIFT);

Here doesn't make sense. you give a u64 type cast, but change the meaning of pfn. Is pfn phys_addr_t? Anyway, page_to_pfn can be re-fulfilled in your arch, but not change it in common code.

No, it actually makes a lot of sense.

The PFN may well be 32-bit, but then shifting it by PAGE_SHIFT turns the PFN from a PFN to a physical address. So the cast makes sense as a way to make sure that the code allows a 32-bit PFN with a 64-bit physical address.

So I don't thionk there's anything tile-specific about it, and it looks like a sane patch. If anything, it might make some sense to make this an explicit thing, ie have a "pfn_to_phys()" helper, because there's a _lot_ of these things open-coded.

And some of them actually have the cast already. See for example

	#define pfn_to_nid(pfn)	pa_to_nid(((u64)(pfn) << PAGE_SHIFT))

in the alpha <asm/mmzone.h>. Also:

	resource_size_t offset = ((resource_size_t)pfn) << PAGE_SHIFT;

in the powerpc PCI code, of

	#define page_to_phys(page)  ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)

in the x86 io code.

In fact, UM has that "pfn_to_phys()" helper already (and has a (phys_t) cast).

So we do already have a lot of casts (just grep for "pfn.*<<.*SHIFT" and you'll see them in generic code already, and the new one for tile makes 100% sense. In fact, we should clean up the existing ones.

Linus

#3 lore raw
In reply to Barry Song
Quoted 6 lines · Barry Song
Quoted 4 lines · Chris Metcalf
include/linux/mm.h 2010-05-17 12:54:33.540145000 -0400 renamed from include/linux/mm.h 2010-05-16 17:17:36.000000000 -0400 +0 -0
@@ -592,7 +592,7 @@
 
Quoted 12 lines

include/linux/mm.h 2010-05-17 12:54:33.540145000 -0400 line 596

Quoted 5 lines
include/linux/mm.h 2010-05-17 12:54:33.540145000 -0400 renamed from include/linux/mm.h 2010-05-16 17:17:36.000000000 -0400 +1 -1
 static __always_inline void *lowmem_page_address(struct page *page)
 {
-       return __va(page_to_pfn(page) << PAGE_SHIFT);
+       return __va((phys_addr_t)page_to_pfn(page) << PAGE_SHIFT);
 

Here doesn't make sense. you give a u64 type cast, but change the meaning of pfn. Is pfn phys_addr_t? Anyway, page_to_pfn can be re-fulfilled in your arch, but not change it in common code. [...]
Your patch is not compilable, and the subject doesn't match well with the content. I think you need re-organize patches.

Where do you see the compilation failure? I tested this with the only other architecture I have handy (x86_64) and it built OK. And by code inspection, <linux/mm.h> includes <linux/mm_types.h> includes <linux/types.h>, which always provides phys_addr_t suitably (based on CONFIG_PHYS_ADDR_T_64BIT).

In any case, a better solution might be to #include <linux/pfn.h> in <linux/mm.h> and write this function as:

static __always_inline void *lowmem_page_address(struct page *page)

{
        return __va(PFN_PHYS(page_to_pfn(page));
}

Note that PFN_PHYS() is already defined to include the cast to phys_addr_t. Jeremy Fitzhardinge added the cast in Sep 2008 with a comment that echoes this discussion:

generic: make PFN_PHYS explicitly return phys_addr_t

PFN_PHYS, as its name suggests, turns a pfn into a physical address. However, it is a macro which just operates on its argument without modifying its type. pfns are typed unsigned long, but an unsigned long may not be long enough to hold a physical address (32-bit systems with more than 32 bits of physcial address).

Make sure we cast to phys_addr_t to return a complete result.

Linus, does this seem like the right generic answer, or would it make more sense, as you suggested, to try to provide a new pfn_to_phys() function in the architecture-independent code?

In any case, in the spirit of providing a complete answer, I'll provide a proper patch in a following email.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#4 lore raw
Quoted 7 lines · Chris Metcalf
Quoted 6 lines · Barry Song
Quoted 4 lines · Chris Metcalf
include/linux/mm.h    2010-05-17 12:54:33.540145000 -0400 renamed from include/linux/mm.h     2010-05-16 17:17:36.000000000 -0400 +0 -0
@@ -592,7 +592,7 @@
 
Quoted 11 lines
Quoted 11 lines

include/linux/mm.h    2010-05-17 12:54:33.540145000 -0400 line 596

Quoted 5 lines
include/linux/mm.h    2010-05-17 12:54:33.540145000 -0400 renamed from include/linux/mm.h     2010-05-16 17:17:36.000000000 -0400 +1 -1
  static __always_inline void *lowmem_page_address(struct page *page)
  {
-       return __va(page_to_pfn(page) << PAGE_SHIFT);
+       return __va((phys_addr_t)page_to_pfn(page) << PAGE_SHIFT);
 

Here doesn't make sense. you give a u64 type cast, but change the meaning of pfn. Is pfn phys_addr_t? Anyway, page_to_pfn can be re-fulfilled in your arch, but not change it in common code. [...]
Your patch is not compilable, and the subject doesn't match well with the content. I think you need re-organize patches.

Where does the blade_pci symbol come from? "No matches found" by a grep. Is it exported in your local codes?
Why not just use #if CONFIG_TILE to cover your quirk_tile_blade. And where is CONFIG_TILE?
I guess all will be explained by your arch codes, but this patch depends on your arch codes, so it shouldn't be here by itself.

Quoted 45 lines
Quoted 1 line

Where do you see the compilation failure?  I tested this with the only other architecture I have handy (x86_64) and it built OK.  And by code inspection, <linux/mm.h> includes <linux/mm_types.h> includes <linux/types.h>, which always provides phys_addr_t suitably (based on CONFIG_PHYS_ADDR_T_64BIT).

In any case, a better solution might be to #include <linux/pfn.h> in <linux/mm.h> and write this function as:

static __always_inline void *lowmem_page_address(struct page *page) {
       return __va(PFN_PHYS(page_to_pfn(page));
}

Note that PFN_PHYS() is already defined to include the cast to phys_addr_t.  Jeremy Fitzhardinge added the cast in Sep 2008 with a comment that echoes this discussion:

   generic: make PFN_PHYS explicitly return phys_addr_t

   PFN_PHYS, as its name suggests, turns a pfn into a physical address. However, it is a macro which just operates on its argument without modifying its type.  pfns are typed unsigned long, but an unsigned long may not be long enough to hold a physical address (32-bit systems with more than 32 bits of physcial address).

   Make sure we cast to phys_addr_t to return a complete result.

Linus, does this seem like the right generic answer, or would it make more sense, as you suggested, to try to provide a new pfn_to_phys() function in the architecture-independent code?

In any case, in the spirit of providing a complete answer, I'll provide a proper patch in a following email.

--
Chris Metcalf, Tilera Corp.
http://www.tilera.com

#5 lore raw
Quoted 9 lines · Barry Song
Quoted 3 lines · Barry Song
Quoted 3 lines

Your patch is not compilable, and the subject doesn't match well with the content. I think you need re-organize patches.

Where does the blade_pci symbol come from? "No matches found" by a grep. Is it exported in your local codes?
Why not just use #if CONFIG_TILE to cover your quirk_tile_blade. And where is CONFIG_TILE?

Oh, I see; I thought you were referring to the other bit of quoted patch. Yes, this should be guarded by #ifdef TILE_CONFIG - thanks!

Quoted 3 lines

I guess all will be explained by your arch codes, but this patch depends on your arch codes, so it shouldn't be here by itself.

The arch code is all at

http://www.tilera.com/scm/linux-2.6.34-arch-tile.tar.bz2

I have been reluctant to send it to LKML as an email patch, since it's 270 files, 87 KLoC, about 2.5 MB. I could break it down into multiple patches (arch/tile/kernel/, arch/tile/mm, arch/tile/lib, etc.).

I solicit opinions from the community as to what is the best approach :-)

Meanwhile I'll resend the original platform-independent changes (the MAINTAINER stanza, one line in the PIC Makefile, and the quirk change) as updated git-am patches.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#6 lore raw

PATCH 1/1 generic: make lowmem_page_address() use PFN_PHYS() for improved portability

In reply to Barry Song

This ensures that platforms with lowmem PAs above 32 bits work correctly by avoiding truncating the PA during a left shift.

---
 include/linux/mm.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
include/linux/mm.h +1 -0
index fb19bb9..33bedcf 100644
@@ -13,6 +13,7 @@
 #include <linux/debug_locks.h>
 #include <linux/mm_types.h>
 #include <linux/range.h>
+#include <linux/pfn.h>
 
 struct mempolicy;
 struct anon_vma;
@@ -591,7 +592,7 @@ static inline void set_page_links(struct page *page,

enum zone_type zone,

static __always_inline void *lowmem_page_address(struct page *page) {
- return __va(page_to_pfn(page) << PAGE_SHIFT);
+ return __va(PFN_PHYS(page_to_pfn(page)));
}

#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL)

#7 lore raw
In reply to Chris Metcalf
Quoted 6 lines · Chris Metcalf

At Tilera we have been running Linux 2.6.26 on our architecture for a while and distributing the sources to our customers. We just sync'ed up our sources to 2.6.34 and would like to return it to the community more widely, so I'm hoping to take advantage of the merge window for 2.6.35 to integrate support for our architecture.

As an experiment, I've created a "git format-patch" output file for all the remaining Tilera-specific changes; Alan took the lowmem_page_address() change into -mm, so hopefully that will make it into 2.6.35 as well. I'm reluctant to post all the arch/tile contents to LKML as a single 3 MB monster email, but you can just cut and paste the following command to pull it into git:

wget http://www.tilera.com/scm/linux-2.6.34-arch-tile.patch | git am

In practice I could probably email it without causing grief to anyone's mailer, but in the interests of saving disk and network bandwidth I'll try this way. There are no changes in this patch that affect any other architecture.

Thanks!

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
maintainer
#8 lore raw
Quoted 8 lines · On Saturday 22 May 2010 06:05:19 Chris Metcalf wrote:

As an experiment, I've created a "git format-patch" output file for all the remaining Tilera-specific changes; Alan took the lowmem_page_address() change into -mm, so hopefully that will make it into 2.6.35 as well. I'm reluctant to post all the arch/tile contents to LKML as a single 3 MB monster email, but you can just cut and paste the following command to pull it into git:

wget http://www.tilera.com/scm/linux-2.6.34-arch-tile.patch | git am

Thanks for this. I took an initial look at the code and it looks pretty good as far as I got though not mergeable for 2.6.35 IMHO. There are a number of areas where code should be generic that is not, and there is stuff in there that I think you should submit separately.

Quoted 4 lines

In practice I could probably email it without causing grief to anyone's mailer, but in the interests of saving disk and network bandwidth I'll try this way. There are no changes in this patch that affect any other architecture.

It would help if you can set up an actual git tree to pull from, but it also works the way you did it. I looked mostly at the header files, leaving out the device drivers and oprofile intentionally and I have not yet found time to look at your arch/tile/{lib,kernel,mm}

Quoted 26 lines
 MAINTAINERS                                  |    6 +
 arch/tile/Kbuild                             |    4 +
 arch/tile/Kconfig                            |  533 +
 arch/tile/Kconfig.debug                      |   49 +
 arch/tile/Makefile                           |   68 +
 arch/tile/configs/tile_defconfig             | 1297 +++
 arch/tile/drivers/Makefile                   |   23 +
 arch/tile/drivers/bme_mem.c                  |  408 +
 arch/tile/drivers/bme_mem.h                  |   61 +
 arch/tile/drivers/eeprom.c                   |  366 +
 arch/tile/drivers/eeprom.h                   |   43 +
 arch/tile/drivers/hpi.c                      |  447 +
 arch/tile/drivers/hpi.h                      |   59 +
 arch/tile/drivers/i2c.c                      |  330 +
 arch/tile/drivers/ide-gpio.c                 | 1505 +++
 arch/tile/drivers/iorpc.c                    |  483 +
 arch/tile/drivers/iorpc.h                    |   66 +
 arch/tile/drivers/rshim.c                    |  245 +
 arch/tile/drivers/rshim.h                    |   54 +
 arch/tile/drivers/rtc.c                      |  152 +
 arch/tile/drivers/softuart.c                 |  306 +
 arch/tile/drivers/srom.c                     |  409 +
 arch/tile/drivers/srom.h                     |   66 +
 arch/tile/drivers/tilepci_barmem.c           |  320 +
 arch/tile/drivers/tilepci_direct_hv.c        |  517 +
 arch/tile/drivers/tilepci_endp.c             | 1623 +++
Quoted 8 lines
 arch/tile/drivers/tilepci_endp.h             |   32 +
 arch/tile/drivers/tilepci_shared_code.c      | 1600 +++
 arch/tile/drivers/tilepci_shared_code.h      | 1650 +++
 arch/tile/drivers/watchdog.c                 |  449 +
 arch/tile/drivers/xgbe.h                     |  179 +
 arch/tile/drivers/xgbe_main.c                | 1015 ++
 arch/tile/drivers/xgbe_net.c                 | 3377 +++++++
 arch/tile/drivers/xgbe_net_fastio.S          |   32 +

Most of these device drivers should be reviewed separately using the appropriate mailing lists. In general we prefer the drivers to live in drivers/{net,ata,serial,...} than in arch/.../drivers.

The notable exception is pci, which should go to arch/tile/pci but still be reviewed in the pci mailing list.

Quoted 4 lines
arch/tile/oprofile/Makefile                  |    9 +
arch/tile/oprofile/backtrace.c               |   73 +
arch/tile/oprofile/op_common.c               |  352 +
arch/tile/oprofile/op_impl.h                 |   37 +

These should probably go through the oprofile list.

Quoted 8 lines
(quoted diff) +8 -0
+config TILE
+	def_bool y
+	select HAVE_OPROFILE
+	select HAVE_IDE
+	select GENERIC_FIND_FIRST_BIT
+	select GENERIC_FIND_NEXT_BIT
+	select RESOURCES_64BIT
+	select USE_GENERIC_SMP_HELPERS

Review

Quoted 10 lines
(quoted diff) +10 -0
+
+# FIXME: investigate whether we need/want these options.
+#	select HAVE_GENERIC_DMA_COHERENT
+#	select HAVE_DMA_ATTRS
+#	select HAVE_IOREMAP_PROT
+#       select HAVE_OPTPROBES
+#       select HAVE_REGS_AND_STACK_ACCESS_API
+#       select HAVE_HW_BREAKPOINT
+#       select PERF_EVENTS
+#       select HAVE_USER_RETURN_NOTIFIER

You will want to implement PERF_EVENTS, which replaces OPROFILE (you can have both though). You should not need HAVE_IDE, which is deprecated by libata, but you will need to reimplement the driver. HAVE_REGS_AND_STACK_ACCESS_API is a good one, you should implmenent that. HAVE_HW_BREAKPOINT is good, but requires hardware support.

It is unlikely that you need DMA attributes (unless your PCI devices want to use nonstandard ordering rules). Similarly, you hopefully won't need HAVE_GENERIC_DMA_COHERENT.

Quoted 14 lines
(quoted diff) +14 -0
+config HOMECACHE
+	bool "Support for dynamic home cache management"
+	depends on TILERA_MDE
+	---help---
+	  Home cache management allows Linux to dynamically adjust
+	  which core's (or cores') cache is the "home" for every page
+	  of memory.  This allows performance improvements on TILEPro
+	  (for example, by enabling the default "allbutstack" mode
+	  where stack pages are always homed on the core running the
+	  task).  TILE64 has less performant cache-coherent support,
+	  so it is not recommended to disable homecaching for TILE64.
+
+config DATAPLANE
+	bool "Support for Zero-Overhead Linux mode"

Review

Quoted 10 lines
(quoted diff) +10 -0
+	depends on SMP
+	depends on NO_HZ
+	depends on TILERA_MDE
+	---help---
+	  Zero-Overhead Linux mode, also called "dataplane" mode,
+	  allows Linux cpus running only a single user task to run
+	  without any kernel overhead on that cpu.  The normal
+	  scheduler tick is disabled, kernel threads such as the
+	  softlockup thread are not run, kernel TLB flush IPIs are
+	  deferred, vmstat updates are not performed, etc.

These sound like very interesting features that may also be useful for other architectures. I would recommend splitting them out into separate patches, by removing the support from the base architecture patch, and submitting the two patches for these features for discussion on the linux-kernel and linux-arch mailing lists.

Review

Quoted 4 lines
(quoted diff) +4 -0
+choice
+	depends on EXPERIMENTAL
+	prompt "Memory split" if EMBEDDED
+	default VMSPLIT_3G

I would recommend leaving out this option on your architecture because of the craziness. If I understand you correctly, the CPUs are all 64 bit capable, so there is little point in micro-optimizing the highmem case.

Review

Quoted 6 lines
(quoted diff) +6 -0
+config XGBE_MAIN
+	tristate "Tilera GBE/XGBE character device support"
+	default y
+	depends on HUGETLBFS
+	---help---
+	  This is the low-level driver for access to xgbe/gbe/pcie.

This should go to drivers/net/Kconfig.

Review

Quoted 8 lines
(quoted diff) +8 -0
+config TILEPCI_ENDP
+	tristate "Tilera PCIE Endpoint Channel Driver"
+	default y
+	depends on !TILEGX
+	---help---
+	  This device is required on Tilera PCI cards; the driver
+	  allows Tilera Linux on the chip to communicate with the
+	  Intel Linux running on the host.

This driver is likely one of the hardest things to review. I'd recommend leaving it out of the arch patch for now and submitting it for a separate review together with the host side driver.

Review

Quoted 6 lines
(quoted diff) +6 -0
+config TILE_IDE_GPIO
+	bool "Tilera IDE driver for GPIO"
+	depends on IDE
+	default y
+	---help---
+	  This device provides an IDE interface using the GPIO pins.

replace this with a driver in drivers/ata.

Review

Quoted 7 lines
(quoted diff) +7 -0
+config TILE_SOFTUART
+	bool "Tilera Soft UART"
+	default n
+	depends on !TILEGX
+	---help---
+	  This device provides access to the FlexIO UART functionality.
+	  It requires a dedicated hypervisor "softuart" driver tile.

I haven't looked at the driver, but it's very likely that you want to replace it with either a backend for drivers/char/hvc_console.c or drivers/serial/serial_core.c, modeled after the other drivers using those interfaces. serial_core is for things that look like an actual UART, while hvc_console is for abstracted interfaces that have a simple read/write interface like a hypervisor.

[skipping device drivers]

Quoted 7 lines
arch/tile/feedback/cachepack.c new file +2 -0
new file mode 100644
index 0000000..7b54348
+#include "file.h"
+#include <arch/chip.h>

arch/tile/feedback/cachepack.c

Quoted 10 lines
arch/tile/feedback/cachepack.c new file +10 -0
+#ifdef __KERNEL__
+#define THREADS_SUPPORTED
+#include <linux/slab.h>
+#include <linux/types.h>
+#include <linux/module.h>
+#include <linux/spinlock.h>
+#include <linux/mm.h>
+#else
+#include "threads.h"
+#include "mmap.h"

This file looks like mixed kernel/user code, which is something we don't normally do. It also does not follow kernel coding style. I'd suggest splitting the implementation and having the kernel version only include the necessary code without all the #ifdef and in normal style.

You could also leave this out for now.

Quoted 12 lines
arch/tile/include/arch/abi.h new file +6 -0
new file mode 100644
index 0000000..18ad6a0
@@ -0,0 +1,93 @@
+// Copyright 2010 Tilera Corporation. All Rights Reserved.
+//
+//   This program is free software; you can redistribute it and/or
+//   modify it under the terms of the GNU General Public License
+//   as published by the Free Software Foundation, version 2.
+//

arch/tile/include/arch/abi.h line 16

Quoted 10 lines
arch/tile/include/arch/abi.h new file +10 -0
+//   This program is distributed in the hope that it will be useful, but
+//   WITHOUT ANY WARRANTY; without even the implied warranty of
+//   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+//   NON INFRINGEMENT.  See the GNU General Public License for
+//   more details.
+
+//! @file
+//!
+//! ABI-related register definitions helpful when writing assembly code.
+//!

This file uses nonstandard formatting of the comments. Is it a generated file, or something that needs to be shared with other projects?

If it is not shared with anything that strictly mandates the style, I'd recommend moving to regular kernel style.

Quoted 12 lines
arch/tile/include/arch/abi.h new file +12 -0
+//! Get the current cycle count.
+//!
+static __inline unsigned long long
+get_cycle_count(void)
+{
+  unsigned int high = __insn_mfspr(SPR_CYCLE_HIGH);
+  unsigned int low = __insn_mfspr(SPR_CYCLE_LOW);
+  unsigned int high2 = __insn_mfspr(SPR_CYCLE_HIGH);
+  if (__builtin_expect(high == high2, 1))
+  {
+#ifdef __TILECC__
+#pragma frequency_hint FREQUENT

arch/tile/include/arch/abi.h line 38

Quoted 10 lines
arch/tile/include/arch/abi.h new file +10 -0
+#endif
+    return (((unsigned long long)high) << 32) | low;
+  }
+  do {
+    low = __insn_mfspr(SPR_CYCLE_LOW);
+    high = high2;
+    high2 = __insn_mfspr(SPR_CYCLE_HIGH);
+  } while (high != high2);
+  return (((unsigned long long)high) << 32) | low;
+}

I would not use these functions directly in driver code. You could move all of cycle.h to timex.h and rename get_cycle_count to get_cycles. The other functions are not used anywhere, so they don't need to be part of the header.

You should also implement read_current_timer using this so you can avoid the expensive delay loop calibration at boot time.

arch/tile/include/arch/abi.h line 47

Quoted 9 lines
arch/tile/include/arch/abi.h new file +9 -0
+//! Delay for a brief period.
+//!
+//! As implemented, this function is a six-cycle slow SPR read.
+//!
+static __USUALLY_INLINE void
+cycle_relax(void)
+{
+  __insn_mfspr(SPR_PASS);
+}

Another abstraction you can kill by moving this directly to cpu_relax and calling that from your relax().

arch/tile/include/arch/abi.h line 60

Quoted 13 lines
arch/tile/include/arch/abi.h new file +13 -0
+/* Use __ALWAYS_INLINE to force inlining, even at "-O0". */
+#ifndef __ALWAYS_INLINE
+#define __ALWAYS_INLINE __inline __attribute__((always_inline))
+#endif
+
+/* Use __USUALLY_INLINE to force inlining even at "-Os", but not at "-O0". */
+#ifndef __USUALLY_INLINE
+#ifdef __OPTIMIZE__
+#define __USUALLY_INLINE __ALWAYS_INLINE
+#else
+#define __USUALLY_INLINE
+#endif
+#endif

Please get rid of these abstraction, inlining is already hard enough with the macros we have in the common code. We have an __always_inline macro that is defined the same way as yours and if you can make a good case for your __USUALLY_INLINE, we can add that as __usually_inline to linux/compiler.h

Quoted 6 lines
arch/tile/include/asm/Kbuild new file +0 -0
new file mode 100644
index 0000000..c191db6

arch/tile/include/asm/Kbuild line 10

Quoted 10 lines
arch/tile/include/asm/Kbuild new file +10 -0
@@ -0,0 +1,17 @@
+include include/asm-generic/Kbuild.asm
+
+header-y += hardwall.h
+header-y += memprof.h
+header-y += ucontext.h
+header-y += user.h
+
+unifdef-y += bme.h
+unifdef-y += page.h
+unifdef-y += tilepci.h

note that header-y and unifdef-y are now synonyms, you can just make them all header-y.

Do you really need to export user.h and page.h?

arch/tile/include/asm/Kbuild line 16

Quoted 6 lines
arch/tile/include/asm/Kbuild new file +6 -0
+# FIXME: The kernel probably shouldn't provide these to user-space,
+# but it's convenient for now to do so.
+unifdef-y += opcode-tile.h
+unifdef-y += opcode_constants.h
+unifdef-y += opcode-tile_32.h
+unifdef-y += opcode_constants_32.h

The comment is right, they should not be exported.

arch/tile/include/asm/a.out.h

Quoted 5 lines
arch/tile/include/asm/a.out.h new file +0 -0
new file mode 100644
index 0000000..36ee719

Should not be needed, just remove this file.

arch/tile/include/asm/addrspace.h

Quoted 2 lines
arch/tile/include/asm/addrspace.h new file +0 -0

This file is not referenced anywhere. I'd suggest removing it until you send code that actually uses it.

arch/tile/include/asm/asm.h

Quoted 5 lines
arch/tile/include/asm/asm.h new file +0 -0
new file mode 100644
index 0000000..f064bc4

Can be removed. syscall_table.S is the only user (of just one of its macros), so just change that file to not rely on the header.

Quoted 5 lines
arch/tile/include/asm/atomic.h new file +0 -0
new file mode 100644
index 0000000..a4f4714

arch/tile/include/asm/atomic.h

Quoted 10 lines
arch/tile/include/asm/atomic.h new file +10 -0
+
+#ifndef _ASM_TILE_ATOMIC_H
+#define _ASM_TILE_ATOMIC_H
+
+#ifndef __ASSEMBLY__
+
+#include <linux/compiler.h>
+#include <asm/system.h>
+
+#define ATOMIC_INIT(i)	{ (i) }

This file looks mostly generic, and is to a large extent the same as the existing asm-generic/atomic.h. Could you add an #ifdef atomic_add_return to the definition of that in the generic file and use that, overriding the functions that need to be architecture specific on SMP systems?

arch/tile/include/asm/atomic_32.h

Quoted 9 lines
arch/tile/include/asm/atomic_32.h new file +4 -0
new file mode 100644
index 0000000..e4f8b4f
+#ifndef _ASM_TILE_ATOMIC_32_H
+#define _ASM_TILE_ATOMIC_32_H
+
+#include <arch/chip.h>

It's unclear why part of atomic.h is split out into atomic_32.h, especially when the file actually contains the definitions for atomic64_t ;-).

Quoted 10 lines
arch/tile/include/asm/backtrace.h new file +5 -0
new file mode 100644
index 0000000..3e65364
+#ifndef _TILE_BACKTRACE_H
+#define _TILE_BACKTRACE_H
+
+#ifndef _LANGUAGE_ASSEMBLY
+

arch/tile/include/asm/backtrace.h

Quoted 10 lines
arch/tile/include/asm/backtrace.h new file +10 -0
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifdef __KERNEL__
+#include <linux/types.h>
+#else
+#include <stdint.h>
+#include <stdbool.h>
+#endif

The file backtrace.h is not exported to user space, so you don't need any of these guards in the kernel. It should also be changed to follow regular coding style.

arch/tile/include/asm/bitops.h

Quoted 5 lines
arch/tile/include/asm/bitops.h new file +0 -0
new file mode 100644
index 0000000..dc3228e

This file looks completely generic, but improved over the asm-generic/bitops/* files by using compiler builtins where possible.
It would be nice if you could change the generic code to use the same builtins when possible.

Quoted 13 lines
arch/tile/include/asm/bitops.h new file +13 -0
+#include <linux/compiler.h>
+#include <asm/atomic.h>
+#include <asm/system.h>
+
+/* Tile-specific routines to support <asm/bitops.h>. */
+unsigned long _atomic_or(volatile unsigned long *p, unsigned long mask);
+unsigned long _atomic_andn(volatile unsigned long *p, unsigned long mask);
+unsigned long _atomic_xor(volatile unsigned long *p, unsigned long mask);
+
+/**
+ * set_bit - Atomically set a bit in memory
+ * @nr: the bit to set
+ * @addr: the address to start counting from

arch/tile/include/asm/bitops.h

Quoted 10 lines
arch/tile/include/asm/bitops.h new file +10 -0
+ *
+ * This function is atomic and may not be reordered.
+ * See __set_bit() if you do not require the atomic guarantees.
+ * Note that @nr may be almost arbitrarily large; this function is not
+ * restricted to acting on a single-word quantity.
+ */
+static inline void set_bit(unsigned nr, volatile unsigned long *addr)
+{
+	_atomic_or(addr + BIT_WORD(nr), BIT_MASK(nr));
+}

Why not just declare set_bit (and other functions from here) to be extern?

arch/tile/include/asm/bitops.h

Quoted 3 lines

+++ b/arch/tile/include/asm/bitsperlong.h

arch/tile/include/asm/bitops.h new file +2 -0
+
+# define __BITS_PER_LONG 32

This seems wrong, unless you support _only_ 32 bit user space.

arch/tile/include/asm/bitops.h

Quoted 8 lines
arch/tile/include/asm/bitops.h new file +8 -0
+#ifndef _ASM_TILE_BME_H
+#define _ASM_TILE_BME_H
+
+#ifndef __KERNEL__
+#include <stdint.h>
+#else
+#include <linux/types.h>
+#endif

Don't do this, just use the __u32 and similar types in data structures. The stdint.h types are problematic in exported kernel headers.

arch/tile/include/asm/bitops.h

Quoted 7 lines
arch/tile/include/asm/bitops.h new file +7 -0
+/**
+ * Descriptor for user memory attributes.
+ */
+struct bme_user_mem_desc {
+	void *va;		/**< Address of memory. */
+	uint32_t len;		/**< Length of memory in bytes. */
+};

Pointers in ioctl data structures are bad because they require conversion between 32 bit applications and 64 bit kernels. Better use a __u64 member or try to avoid the pointers entirely.

arch/tile/include/asm/bitops.h

Quoted 8 lines
arch/tile/include/asm/bitops.h new file +8 -0
+/**
+ * Descriptor for physical memory attributes.
+ */
+struct bme_phys_mem_desc {
+	uint64_t pa;		/**< Physical address of memory. */
+	uint32_t len;		/**< Length of memory in bytes. */
+	uint64_t pte;		/**< Caching attributes. */
+};

This data structure has implicit padding. I suspect that this is ok on your arch, but in general you should make the padding explicit or avoid it by aligning the members. Just make len a __u64 here.

The problem is that code that is portable to x86 behaves differently in 32 and 64 bit mode: x86-32 does not add padding here.

arch/tile/include/asm/bitops.h

Quoted 9 lines
arch/tile/include/asm/bitops.h new file +9 -0
+/** Get the number of pages this range of memory covers. */
+#define BME_IOC_GET_NUM_PAGES _IO(BME_IOC_TYPE, 0x0)
+
+/**
+ * Lock the memory so it can be accessed by BME tiles.  User must provide
+ * space for the number of pages included in this range.  That number may
+ * be obtained by BME_IOC_GET_NUM_PAGES, above.
+ */
+#define BME_IOC_LOCK_MEMORY _IO(BME_IOC_TYPE, 0x1)

These should actually be _IOWR, not _IO, because you are passing data structures.

arch/tile/include/asm/bugs.h line 9

Quoted 12 lines
arch/tile/include/asm/bugs.h new file +9 -0
@@ -0,0 +1,22 @@
+
+#ifndef _ASM_TILE_BUGS_H
+#define _ASM_TILE_BUGS_H
+
+static inline void check_bugs(void)
+{
+}
+
+#endif /* _ASM_TILE_BUGS_H */

While this file is trivial, please just use the asm-generic version anyway. I have a patch (and have had it for ages) that lets you leave out any files that only contain a redirect to asm-generic.

arch/tile/include/asm/checksum.h

Quoted 5 lines
arch/tile/include/asm/checksum.h new file +0 -0
new file mode 100644
index 0000000..079ab67

I believe you can use the asm-generic version here.

arch/tile/include/asm/compat.h

Quoted 5 lines
arch/tile/include/asm/compat.h new file +0 -0
new file mode 100644
index 0000000..5703968

We don't have an architecture using the asm-generic headers with CONFIG_COMPAT support yet, so tile would be the first one. I think you should just move this file to include/asm-generic/compat.h and use that, so future architectures don't need to define their own.

arch/tile/include/asm/compat.h

Quoted 12 lines
arch/tile/include/asm/compat.h new file +12 -0
+/*
+ * Idle the core for 8 * iterations cycles.
+ * Also make this a compiler barrier, as it's sometimes used in
+ * lieue of cpu_relax(), which has barrier semantics.
+ */
+static inline void
+relax(int iterations)
+{
+	for (/*above*/; iterations > 0; iterations--)
+		cycle_relax();
+	barrier();
+}

I'd rather not make this part of the interface. Just move this definition to your spinlock_32.c file and use an open-coded version in delay.c

arch/tile/include/asm/compat.h

Quoted 13 lines
arch/tile/include/asm/compat.h new file +13 -0
+static inline void
+dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
+			enum dma_data_direction direction)
+{
+	panic("dma_sync_single_for_cpu");
+}
+
+static inline void
+dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
+			   size_t size, enum dma_data_direction direction)
+{
+	panic("dma_sync_single_for_device");
+}

These definitions do not look helful. If you cannot figure out what to do here, it may be better to just declare functions without a definition so you get a link error for drivers that need them instead of a runtime panic.

Usually you need to do the same thing you do while mapping when you sync to the device (e.g. a cache flush) and potentially a cache invalidate when you sync to the CPU.

arch/tile/include/asm/dma.h

Quoted 5 lines
arch/tile/include/asm/dma.h new file +0 -0
new file mode 100644
index 0000000..002f12a

The asm-generic version should be enough unless you plan to support legacy ISA extension cards.

arch/tile/include/asm/dma.h

Quoted 13 lines
arch/tile/include/asm/dma.h new file +13 -0
+#ifndef _ASM_TILE_HARDWALL_H
+#define _ASM_TILE_HARDWALL_H
+
+#include <linux/ioctl.h>
+
+struct hardwall_rectangle {
+	int ulhc_x;
+	int ulhc_y;
+	int width;
+	int height;
+};
+
+#define HARDWALL_FILE "/proc/tile/hardwall"

This does not look right, /proc files should not be used with ioctl, although we have a few existing cases already. You could probably change this to a misc chardev or a debugfs file.

Quoted 10 lines
arch/tile/include/asm/dma.h new file +10 -0
+static inline void *memcpy_fromio(void *dst, void *src, int len)
+{
+	int x;
+	if ((unsigned long)src & 0x3)
+		panic("memcpy_fromio from non dword aligned address");
+	for (x = 0; x < len; x += 4)
+		*(u32 *)(dst + x) = readl(src + x);
+	return dst;
+}
+

arch/tile/include/asm/dma.h

Quoted 10 lines
arch/tile/include/asm/dma.h new file +10 -0
+static inline void *memcpy_toio(void *dst, void *src, int len)
+{
+	int x;
+	if ((unsigned long)dst & 0x3)
+		panic("memcpy_toio to non dword aligned address");
+	for (x = 0; x < len; x += 4)
+		writel(*(u32 *)(src + x), dst + x);
+	return dst;
+}
+

panic looks a bit harsh here. Maybe BUG_ON?

arch/tile/include/asm/kmap_types.h

Quoted 5 lines
arch/tile/include/asm/kmap_types.h new file +0 -0
new file mode 100644
index 0000000..1480106

Any reason for having your own copy of this instead of the generic file?

arch/tile/include/asm/kvm.h

Quoted 5 lines
arch/tile/include/asm/kvm.h new file +0 -0
new file mode 100644
index 0000000..7ed6877

If you don't support kvm, just remove this file.

arch/tile/include/asm/mman.h

Quoted 5 lines
arch/tile/include/asm/mman.h new file +0 -0
new file mode 100644
index 0000000..e448d45

This looks like you can use the asm-generic/mman.h file.

Quoted 11 lines
arch/tile/include/asm/mman.h new file +11 -0
+/*
+ * Specify the "home cache" for the page explicitly.  The home cache is
+ * the cache of one particular "home" cpu, which is used as a coherence
+ * point for normal cached operations.  Normally the kernel chooses for
+ * you, but you can use the MAP_CACHE_HOME_xxx flags to override.
+ *
+ * User code should not use any symbols with a leading "_" as they are
+ * implementation specific and may change from release to release
+ * without warning.
+ *
+ * See the Tilera mmap(2) man page for more details (e.g. "tile-man mmap").

arch/tile/include/asm/mman.h

Quoted 10 lines
arch/tile/include/asm/mman.h new file +10 -0
+ */
+
+/* Implementation details; do not use directly. */
+#define _MAP_CACHE_INCOHERENT   0x40000
+#define _MAP_CACHE_HOME         0x80000
+#define _MAP_CACHE_HOME_SHIFT   20
+#define _MAP_CACHE_HOME_MASK    0x3ff
+#define _MAP_CACHE_MKHOME(n) \
+  (_MAP_CACHE_HOME | (((n) & _MAP_CACHE_HOME_MASK) << _MAP_CACHE_HOME_SHIFT))
+

Since the file is exported to user space, the map_cache stuff probably should not be here, but get moved to a different header that is private to the kernel.

arch/tile/include/asm/posix_types.h

Quoted 5 lines
arch/tile/include/asm/posix_types.h new file +0 -0
new file mode 100644
index 0000000..ab71c9c

Anything wrong with the asm-generic version of this file? You really should not need to define your own version, because this is relevant to the user ABI.

arch/tile/include/asm/sembuf.h

Quoted 5 lines
arch/tile/include/asm/sembuf.h new file +0 -0
new file mode 100644
index 0000000..d4dc7cd

Same here, this is part of the ABI, so please use the generic version.

arch/tile/include/asm/shmparam.h

Quoted 5 lines
arch/tile/include/asm/shmparam.h new file +0 -0
new file mode 100644
index 0000000..bc99ff6

and here.

Quoted 4 lines
arch/tile/include/asm/sigcontext.h new file +2 -0
+
+#ifndef _ASM_TILE_SIGCONTEXT_H

arch/tile/include/asm/sigcontext.h

Quoted 10 lines
arch/tile/include/asm/sigcontext.h new file +10 -0
+#define _ASM_TILE_SIGCONTEXT_H
+
+/* NOTE: we can't include <linux/ptrace.h> due to #include dependencies. */
+#include <asm/ptrace.h>
+
+/* Must track <sys/ucontext.h> */
+
+struct sigcontext {
+	struct pt_regs regs;
+};

The comments both do not match the code apparently.

arch/tile/include/asm/spinlock_32.h

Quoted 5 lines
arch/tile/include/asm/spinlock_32.h new file +0 -0
new file mode 100644
index 0000000..c609041

This file could just be renamed to spinlock.h, afaict.

arch/tile/include/asm/stat.h

Quoted 5 lines
arch/tile/include/asm/stat.h new file +0 -0
new file mode 100644
index 0000000..4d86b4e

part of the ABI, please don't define your own.

Quoted 14 lines
arch/tile/include/asm/timex.h new file +11 -0
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2010 Tilera Corporation. All Rights Reserved.
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation, version 2.
+ *
+ *   This program is distributed in the hope that it will be useful, but
+ *   WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ *   NON INFRINGEMENT.  See the GNU General Public License for

arch/tile/include/asm/timex.h line 21

Quoted 10 lines
arch/tile/include/asm/timex.h new file +10 -0
+ *   more details.
+ */
+
+#ifndef _ASM_TILE_TIMEX_H
+#define _ASM_TILE_TIMEX_H
+
+#include <arch/cycle.h>
+
+/* Use this random value, just like most archs.  Mysterious. */
+#define CLOCK_TICK_RATE	1193180 /* Underlying HZ */

long story. It should however actually be something related to the your frequency, not the time base of the i8253 chip that I hope you are not using.

arch/tile/include/asm/unistd.h

Quoted 5 lines
arch/tile/include/asm/unistd.h new file +0 -0
new file mode 100644
index 0000000..616dc7d

Your unistd.h file contains syscall numbers for many calls that you should not need in a new architecture. Please move to the asm-generic/unistd.h file instead. There may be a few things you need to do in libc to get there, but this version is no good. If you have problems with asm-generic/unistd.h (or any of the other asm-generic files), feel free to ask me for help.

Arnd

#9 lore raw
Quoted 8 lines · Arnd Bergmann
Quoted 2 lines · On Saturday 22 May 2010 06:05:19 Chris Metcalf wrote:

As an experiment, I've created a "git format-patch" output file for all the remaining Tilera-specific changes [...]

Thanks for this. I took an initial look at the code and it looks pretty good as far as I got though not mergeable for 2.6.35 IMHO.

First of all, thank YOU for your review!

Perhaps what we can do is shoot for including a "first round" set of Tilera support in 2.6.35, which is sufficient to boot the chip up and work with it, but defer some of the drivers and other features (oprofile, etc.) for a later merge window.

Quoted 2 lines

It would help if you can set up an actual git tree to pull from, but it also works the way you did it.

Hopefully we'll have one by next month sometime. We have to reprovision our existing web server, so that has to be coordinated with Marketing, etc. I think for this round we'll have to stick to downloading git patches, unfortunately.

Quoted 8 lines

Most of these device drivers should be reviewed separately using the appropriate mailing lists. In general we prefer the drivers to live in drivers/{net,ata,serial,...} than in arch/.../drivers.

The notable exception is pci, which should go to arch/tile/pci but still be reviewed in the pci mailing list.

So this is an interesting question. Currently the "device driver" support in the arch/tile/drivers directory is for devices which exist literally only as part of the Tilera silicon, i.e. they are not separable from the tile architecture itself. For example, the network driver is tied to the Tilera networking shim DMA engine on the chip. Does it really make sense to move this to a directory where it is more visible to other architectures? I can see that it might from the point of view of code bombings done to network drivers, for example. Similarly for our other drivers, which are tied to details of the hypervisor API, etc.

For this first round of Tilera code, I will plan to push only the PCI driver support (which makes sense to move to its own arch/tile/pci/ directory anyway, since there are half a dozen files there). I'll put the PCI stuff in its own commit and then cc it to the linux-pci list at vger.

There is a very minimal hypervisor-API console driver in arch/tile/kernel/ which I will plan to just leave there for now.

Quoted 7 lines
Quoted 5 lines
arch/tile/oprofile/Makefile                  |    9 +
arch/tile/oprofile/backtrace.c               |   73 +
arch/tile/oprofile/op_common.c               |  352 +
arch/tile/oprofile/op_impl.h                 |   37 +

These should probably go through the oprofile list.

OK. I'll put these in a separate commit as well. These in any case are not critical for inclusion in the initial batch of Tilera support.

Quoted 1 line

You will want to implement PERF_EVENTS, which replaces OPROFILE

Yes, we're planning this, and in fact some friendly folks at {large company I may not be supposed to name} are working on this with us at the moment. I don't think it will be part of this initial code push, though.

Quoted 3 lines

(you can have both though). You should not need HAVE_IDE, which is deprecated by libata, but you will need to reimplement the driver.

I'll file a bug internally on this for us to review. If we make ATA support a second-round thing anyway, we can do this in a more leisurely manner.

Quoted 1 line

HAVE_REGS_AND_STACK_ACCESS_API is a good one, you should implmenent that.

OK. I think this may be straightforward enough to just do as part of the first round of code.

Quoted 2 lines

HAVE_HW_BREAKPOINT is good, but requires hardware support.

We do have some of this support (though with some skid), but in any case its use needs to be coordinated with the oprofile/perf_event counters, so we haven't gotten around to it yet. We have a bug open on this internally already, though.

Quoted 14 lines

+config HOMECACHE

Review

Quoted 6 lines
(quoted diff) +3 -0
+	bool "Support for dynamic home cache management"
[...]
+config DATAPLANE
+	bool "Support for Zero-Overhead Linux mode"

These sound like very interesting features that may also be useful for other architectures. I would recommend splitting them out into separate patches, by removing the support from the base architecture patch, and submitting the two patches for these features for discussion on the linux-kernel and linux-arch mailing lists.

Yes, the intent was to submit them later, since they are more controversial in that they touch platform-independent code. One thing you'll notice in our Kconfig is a TILERA_MDE config option. This is effectively a toggle to allow the same Kconfig to be used for both the code we're returning to the community now, and for the "full featured" version that we are hacking freely in our MDE ("multicore development environment", which is what we call the software we ship with the chip).

My initial model was that we would submit all the arch/tile/ code up to the community, including the code that couldn't yet be enabled due to missing architecture-independent support. Adding the architecture-independent code would then be done in a separate patch thread. But this leaves the Tilera architecture-dependent code present in the initial submission. How confusing do you think this situation would be? I could just run our code through an unifdef to remove things tagged with CONFIG options that can't be enabled due to missing architecture-independent support.

Quoted 10 lines

Review

Quoted 5 lines
(quoted diff) +4 -0
+choice
+	depends on EXPERIMENTAL
+	prompt "Memory split" if EMBEDDED
+	default VMSPLIT_3G

I would recommend leaving out this option on your architecture because of the craziness. If I understand you correctly, the CPUs are all 64 bit capable, so there is little point in micro-optimizing the highmem case.

No, our current shipping hardware is 32-bit only. The next generation is 64-bit capable so does not use HIGHMEM and doesn't need to allow the craziness. I added a "depends on !TILEGX" to disable it in that case.

Quoted 9 lines

Review

Quoted 7 lines
(quoted diff) +6 -0
+config XGBE_MAIN
+	tristate "Tilera GBE/XGBE character device support"
+	default y
+	depends on HUGETLBFS
+	---help---
+	  This is the low-level driver for access to xgbe/gbe/pcie.

This should go to drivers/net/Kconfig.

Maybe not. This driver is just a character device that allows a user process to talk to the networking hardware directly. For example, you might have an eth0 that is just a normal PCI device using the platform-independent networking code, and then have user-space code driving the 10 Gb on-chip NICs without involving the kernel networking stack. The Linux networking support (tagged with XGBE_NET) is layered on top of this driver.

Quoted 11 lines

arch/tile/feedback/cachepack.c

Quoted 3 lines
arch/tile/feedback/cachepack.c +0 -0
[...]

This file looks like mixed kernel/user code, which is something we don't normally do. It also does not follow kernel coding style. I'd suggest splitting the implementation and having the kernel version only include the necessary code without all the #ifdef and in normal style.

You could also leave this out for now.

Yes, for now I'll just leave this feedback-compilation support out. In another place we have stack backtracing support that is also shared, but we can actually just unifdef the file when we install it in the kernel tree, so there will be some blank lines (to make it easier to use line-number information on the original source) but no __KERNEL__ ifdefs in the kernel source.

Quoted 10 lines

arch/tile/include/arch/abi.h

Quoted 3 lines
arch/tile/include/arch/abi.h +0 -0
[...]

This file uses nonstandard formatting of the comments. Is it a generated file, or something that needs to be shared with other projects?

If it is not shared with anything that strictly mandates the style, I'd recommend moving to regular kernel style.

I'll discuss changing the style with the rest of the Tilera software team. However, we have generally preferred C99 comments for our own non-Linux code, and this "arch/tile/include/arch/" directory represents part of the set of headers that provide access to all the grotty details of the underlying hardware architecture, so can be used within Linux code, or hypervisor code, booter, user space, etc etc, with no libc or kernel header inclusion dependencies.

For what it's worth, there do seem to be plenty of files in the architecture-dependent parts of the kernel, and drivers, that use C99 comments, so there is some precedent for leaving this files in that style. (grep "^//" hits 866 files, for example.)

Quoted 12 lines

arch/tile/include/arch/abi.h

Quoted 6 lines
arch/tile/include/arch/abi.h +4 -0
+//! Get the current cycle count.
+//!
+static __inline unsigned long long
+get_cycle_count(void)
[...]

I would not use these functions directly in driver code. You could move all of cycle.h to timex.h and rename get_cycle_count to get_cycles. The other functions are not used anywhere, so they don't need to be part of the header.

This is another artifact of how we are sharing code between our <arch> headers and Linux. Other parts of our code base use these headers too, so we export the correct clock-capture algorithm here, then instantiate it once for Linux, in arch/tile/kernel/time.c. On our 64-bit chip, the CHIP_HAS_SPLIT_CYCLE() #define is false, so we just directly use the trivial implementation in <arch/cycle.h>.

Quoted 4 lines

You should also implement read_current_timer using this so you can avoid the expensive delay loop calibration at boot time.

We have the following in <asm/timex.h>, which I think should already do what you are saying:

#define ARCH_HAS_READ_CURRENT_TIMER
static inline int read_current_timer(unsigned long *timer_value)

{
        *timer_value = get_cycle_count_low();
        return 0;
}

We actually have a one-line change to init/calibrate.c to use an arch_calibrate_delay_direct() macro if defined, which avoids even having to use read_current_timer(), but since that's platform-independent code, I didn't want to get into it yet.

Quoted 6 lines

arch/tile/include/arch/abi.h

Quoted 3 lines
arch/tile/include/arch/abi.h +2 -0
+static __USUALLY_INLINE void
+cycle_relax(void)

Another abstraction you can kill by moving this directly to cpu_relax and calling that from your relax().

Again, shared code with non-Linux sources.

Quoted 8 lines
Quoted 8 lines
arch/tile/include/arch/abi.h +8 -0
+/* Use __ALWAYS_INLINE to force inlining, even at "-O0". */
+#ifndef __ALWAYS_INLINE
+#define __ALWAYS_INLINE __inline __attribute__((always_inline))
+#endif
+
+/* Use __USUALLY_INLINE to force inlining even at "-Os", but not at "-O0". */
+#ifndef __USUALLY_INLINE
+#ifdef __OPTIMIZE__
Quoted 8 lines

arch/tile/include/arch/abi.h

Quoted 6 lines
arch/tile/include/arch/abi.h +5 -0
+#define __USUALLY_INLINE __ALWAYS_INLINE
+#else
+#define __USUALLY_INLINE
+#endif
+#endif

Please get rid of these abstraction, inlining is already hard enough with the macros we have in the common code.

Yes, I've seen some of the inlining wars go by over the years on Linux forums. But again, these headers are meant to be used in places that don't have access to internal Linux headers, while at the same time being easy to #include within code that does use the Linux headers. We could do some crazy transformation of our <arch> headers and install them as "asm" headers for Linux, or something like that, but then it gets harder to write code that can be used both inside Linux and outside (say, in a user-mode driver, or in the hypervisor).

Quoted 1 line

Do you really need to export user.h and page.h?

We definitely don't need user.h any more; for a while we were building strace to include it, but we haven't been for a while. We do use <asm/page.h> to get the page size in some places, but we could also provide that directly via libc in <sys/page.h> and not involve the kernel. Our build allows tuning the page size but only by recompiling the hypervisor and Linux both, so we just provide page size as a constant. (Though getpagesize() still uses the auxv value passed to user space, just in case we make page size dynamic at some point in the future.)

Quoted 7 lines

arch/tile/include/asm/addrspace.h

Quoted 4 lines
arch/tile/include/asm/addrspace.h new file +0 -0

This file is not referenced anywhere. I'd suggest removing it until you send code that actually uses it.

OK, I've removed it. I assumed that it was required by architectures, since it is used in various places in the kernel. I see four drivers that just include it unconditionally at the moment, though curiously, they don't seem to use any of the symbols it defines. And there are four architectures (avr32, m32r, mips, sh) that all provide this header at the moment, though there doesn't seem to be agreement as to what symbols it should define.

Quoted 10 lines

arch/tile/include/asm/asm.h

Quoted 6 lines
arch/tile/include/asm/asm.h new file +0 -0
new file mode 100644
index 0000000..f064bc4

Can be removed. syscall_table.S is the only user (of just one of its macros), so just change that file to not rely on the header.

Well, true, but it's a good abstraction. I actually was planning to use _ASM_EXTABLE in some of our assembly code, though I hadn't gotten around to doing so yet.

Quoted 8 lines

arch/tile/include/asm/atomic.h

Quoted 2 lines
arch/tile/include/asm/atomic.h +0 -0

This file looks mostly generic, and is to a large extent the same as the existing asm-generic/atomic.h. Could you add an #ifdef atomic_add_return to the definition of that in the generic file and use that, overriding the functions that need to be architecture specific on SMP systems?

Seems like a good idea. I'll look into it. Should I submit the <asm-generic/atomic.h> change first as an independent change from the Tilera architecture stuff, or just include it with the Tilera stuff? Same question for the bitops stuff that you mention later on.

Quoted 4 lines

It's unclear why part of atomic.h is split out into atomic_32.h, especially when the file actually contains the definitions for atomic64_t ;-).

Yeah, that nomenclature does end up a little confusing. We adopted the x86 confusion of using "_32" for our 32-bit architecture (i386 <=> tilepro) and "_64" for our 64-bit architecture (x86_64 <=> tilegx). So here, <asm/atomic_32.h> is the atomic support for our 32-bit architecture, and <asm/atomic_64.h> is the support for our 64-bit architecture. However, I unifdef'ed out the things tagged with "__tilegx__" in our sources, and removed the "*_64.[chS]" files, since the TILE-Gx support is not 100% until we actually start shipping the silicon.

Quoted 9 lines

arch/tile/include/asm/atomic.h

Quoted 5 lines
arch/tile/include/asm/atomic.h +4 -0
+static inline void set_bit(unsigned nr, volatile unsigned long *addr)
+{
+	_atomic_or(addr + BIT_WORD(nr), BIT_MASK(nr));
+}

+#include <linux/compiler.h>
Why not just declare set_bit (and other functions from here) to be extern?

Two reasons. The first is that by exposing the "nr" value here, the compiler can often optimize it away completely, or just convert it to an appropriate constant. If we left it in an extern set_bit() the cpu would always have to do the shifts and adds. Or, if not a constant, the compiler can often use an empty slot in one of our "instruction bundles" leading up to the call to _atomic_or() to hide the construction of the necessary pointer and constant.

Quoted 6 lines

arch/tile/include/asm/atomic.h

Quoted 4 lines

+++ b/arch/tile/include/asm/bitsperlong.h

arch/tile/include/asm/atomic.h +2 -0
+
+# define __BITS_PER_LONG 32

This seems wrong, unless you support _only_ 32 bit user space.

For the current silicon, we do. For the 64-bit silicon, we support either flavor, and we use #ifdef __LP64__ to guard this here. But I'm also unifdef'ing with -U__LP64__ for the sources you're seeing. Perhaps this just ends up being more, rather than less, confusing!

Quoted 5 lines

with CONFIG_COMPAT support yet, so tile would be the first one. I think you should just move this file to include/asm-generic/compat.h and use that, so future architectures don't need to define their own.

Most of it is pretty generic, for sure. Are you comfortable with the part about registers? We use 64-bit registers in our 32-bit mode, since for us "compat" mode is just a 32-bit pointer mode, like DEC Alpha's. So "long long" and "double" are still held in a single 64-bit register regardless. Here's the relevant part:

/* We use the same register dump format in 32-bit images. */ typedef unsigned long compat_elf_greg_t;
#define COMPAT_ELF_NGREG (sizeof(struct pt_regs) / sizeof(compat_elf_greg_t)) typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG];

Quoted 12 lines

arch/tile/include/asm/atomic.h

Quoted 8 lines

+ * Idle the core for 8 * iterations cycles.
+ * Also make this a compiler barrier, as it's sometimes used in
+ * lieue of cpu_relax(), which has barrier semantics.
+ */

arch/tile/include/asm/atomic.h +2 -0
+static inline void
+relax(int iterations)
[...]

I'd rather not make this part of the interface. Just move this definition to your spinlock_32.c file and use an open-coded version in delay.c

We also use this in spinlock_64.c, which of course you didn't see :-) We could just move it to asm/spinlock.h and call it __relax() or some such to suggest that it's not meant to be used by other code. How does that sound?

Quoted 5 lines

+++ b/arch/tile/include/asm/kmap_types.h

Any reason for having your own copy of this instead of the generic file?

Yes, it's because we are concerned about chewing up address space. Each additional km type here requires another page worth of address space per cpu, and since we are using 64KB pages for TLB efficiency in our embedded apps, this means 64KB times 64 processors = 4 MB of address space per km type. (Yes, I've followed the discussions about why large page sizes are bad for general-purpose computing.)

Quoted 1 line

This looks like you can use the asm-generic/mman.h file.

No, the bit values for the constants are wrong. We use bits 0x8000 and up to describe our "homecache" overrides to mmap().

Quoted 4 lines

Since the file is exported to user space, the map_cache stuff probably should not be here, but get moved to a different header that is private to the kernel.

It's part of the optional extended API for mmap() used by Tilera Linux, so it is actually needed by userspace.

Quoted 3 lines

+++ b/arch/tile/include/asm/posix_types.h Anything wrong with the asm-generic version of this file?

I somehow missed being aware of the generic version of this (and of sembuf.h and shmparam.h). It seems likely we can use the generic posix_types.h, and we can certainly use the generic forms of the others.

Quoted 18 lines
Quoted 6 lines
arch/tile/include/asm/sigcontext.h new file +2 -0
+
+#ifndef _ASM_TILE_SIGCONTEXT_H

arch/tile/include/asm/sigcontext.h

Quoted 10 lines
arch/tile/include/asm/sigcontext.h new file +10 -0
+#define _ASM_TILE_SIGCONTEXT_H
+
+/* NOTE: we can't include <linux/ptrace.h> due to #include dependencies. */
+#include <asm/ptrace.h>
+
+/* Must track <sys/ucontext.h> */
+
+struct sigcontext {
+	struct pt_regs regs;
+};

The comments both do not match the code apparently.

Sorry - can you clarify this comment? I don't see the mismatch.

Quoted 5 lines

+++ b/arch/tile/include/asm/spinlock_32.h

This file could just be renamed to spinlock.h, afaict.

Yes, well, there's the spinlock_64.h version hiding behind the unifdef here. :-)

Quoted 3 lines

+++ b/arch/tile/include/asm/stat.h
part of the ABI, please don't define your own.

Unfortunately, changing this would require us to make an incompatible change to current user-space. It may be possible anyway, since we are planning a number of transitions for our next major release (jump from kernel 2.6.26, switch from our current SGI-derived compiler to using gcc, etc.). I'll discuss this internally.

Quoted 7 lines

arch/tile/include/asm/sigcontext.h

Quoted 3 lines
arch/tile/include/asm/sigcontext.h new file +2 -0
+/* Use this random value, just like most archs.  Mysterious. */
+#define CLOCK_TICK_RATE	1193180 /* Underlying HZ */

long story. It should however actually be something related to the your frequency, not the time base of the i8253 chip that I hope you are not using.

No, no i8253. But our clock tick rate is controllable dynamically at boot, so there's certainly no trivial constant that makes sense here. Should I use the slowest possible frequency here? The fastest? It's used in some irrelevant drivers, but also in <linux/jiffies.h>, which is the place that worries me.

Quoted 7 lines

Your unistd.h file contains syscall numbers for many calls that you should not need in a new architecture. Please move to the asm-generic/unistd.h file instead. There may be a few things you need to do in libc to get there, but this version is no good. If you have problems with asm-generic/unistd.h (or any of the other asm-generic files), feel free to ask me for help.

Sounds like we should take this one off-list until I know more precisely what you're worried about. As far as I know, I did not import any pointless syscalls. I have a stanza (which of course is unifdef'ed out of your version) that removes all the foo64() syscalls when used with 64-bit userspace. But I think all the rest are useful.

As for <asm-generic/unistd.h>, I'll look more carefully at it, though of course using it is also dependent on whether it is reasonable for us to completely break compatibility with current user-space programs.

Arnd - MANY thanks for your careful review so far. I will implement what you suggested and await the remainder of your review before resubmitting patches.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
maintainer
#10 lore raw
Quoted 6 lines · On Monday 24 May 2010 17:29:18 Chris Metcalf wrote:
Quoted 1 line · Arnd Bergmann

Perhaps what we can do is shoot for including a "first round" set of Tilera support in 2.6.35, which is sufficient to boot the chip up and work with it, but defer some of the drivers and other features (oprofile, etc.) for a later merge window.

The most important change in my opinion is to get the system call ABI straight, by making sure you don't introduce interfaces that will get in your way later. If you can get the kernel to build using the asm-generic version of unistd.h and the other exported headers, as well as leaving out the device drivers, that should work.

I would also like to wait for another opinion before it goes in. Note that the regular procedure is to have the code reviewed before the start of the merge window, not in the middle of it!

Quoted 7 lines
Quoted 2 lines

It would help if you can set up an actual git tree to pull from, but it also works the way you did it.

Hopefully we'll have one by next month sometime. We have to reprovision our existing web server, so that has to be coordinated with Marketing, etc. I think for this round we'll have to stick to downloading git patches, unfortunately.

I can see two options for speeding that up. The easiest way would be to just make the bare git tree available on http, instead of a single file. If you can rsync or ftp to the web server, that should be sufficient.

Alternatively, you can apply for an account on master.kernel.org, if your company policies allow you to do that. That should be possible within a few days at most and will help others locate your tree.

Quoted 9 lines
Quoted 8 lines

Most of these device drivers should be reviewed separately using the appropriate mailing lists. In general we prefer the drivers to live in drivers/{net,ata,serial,...} than in arch/.../drivers.

The notable exception is pci, which should go to arch/tile/pci but still be reviewed in the pci mailing list.

Quoted 7 lines

So this is an interesting question. Currently the "device driver" support in the arch/tile/drivers directory is for devices which exist literally only as part of the Tilera silicon, i.e. they are not separable from the tile architecture itself. For example, the network driver is tied to the Tilera networking shim DMA engine on the chip. Does it really make sense to move this to a directory where it is more visible to other architectures?

yes.

Quoted 2 lines

I can see that it might from the point
of view of code bombings done to network drivers, for example.

Exactly, that is indeed an important point. It's more important for some subsystems than others, but people generally like to be able to do things like 'grep all network device drivers'.

Quoted 2 lines

Similarly for our other drivers, which are tied to details of the hypervisor API, etc.

Just mark them as 'depends on ARCH_TILE' in Kconfig if you cannot build the drivers elsewhere. Drivers that do not have a good place to go elsewhere in the tree can probably go to drivers/tile/ rather than arch/tile.

Quoted 5 lines

For this first round of Tilera code, I will plan to push only the PCI driver support (which makes sense to move to its own arch/tile/pci/ directory anyway, since there are half a dozen files there). I'll put the PCI stuff in its own commit and then cc it to the linux-pci list at vger.

ok

Quoted 2 lines

There is a very minimal hypervisor-API console driver in arch/tile/kernel/ which I will plan to just leave there for now.

ok. arch/tile/hv might be better if you think that the files will grow substantially, but kernel is also good.

Quoted 6 lines
Quoted 1 line

You will want to implement PERF_EVENTS, which replaces OPROFILE

Yes, we're planning this, and in fact some friendly folks at {large company I may not be supposed to name} are working on this with us at the moment. I don't think it will be part of this initial code push, though.

Ok, it's certainly not required.

Quoted 7 lines
Quoted 3 lines

(you can have both though). You should not need HAVE_IDE, which is deprecated by libata, but you will need to reimplement the driver.

I'll file a bug internally on this for us to review. If we make ATA support a second-round thing anyway, we can do this in a more leisurely manner.

ok

Quoted 4 lines
Quoted 1 line

HAVE_REGS_AND_STACK_ACCESS_API is a good one, you should implmenent that.

OK. I think this may be straightforward enough to just do as part of the first round of code.

good

Quoted 7 lines
Quoted 2 lines

HAVE_HW_BREAKPOINT is good, but requires hardware support.

We do have some of this support (though with some skid), but in any case its use needs to be coordinated with the oprofile/perf_event counters, so we haven't gotten around to it yet. We have a bug open on this internally already, though.

ok

Quoted 23 lines
Quoted 14 lines

+config HOMECACHE

Review

Quoted 6 lines
(quoted diff) +3 -0
+	bool "Support for dynamic home cache management"
[...]
+config DATAPLANE
+	bool "Support for Zero-Overhead Linux mode"

These sound like very interesting features that may also be useful for other architectures. I would recommend splitting them out into separate patches, by removing the support from the base architecture patch, and submitting the two patches for these features for discussion on the linux-kernel and linux-arch mailing lists.

Yes, the intent was to submit them later, since they are more controversial in that they touch platform-independent code. One thing you'll notice in our Kconfig is a TILERA_MDE config option. This is effectively a toggle to allow the same Kconfig to be used for both the code we're returning to the community now, and for the "full featured" version that we are hacking freely in our MDE ("multicore development environment", which is what we call the software we ship with the chip).

Quoted 9 lines

My initial model was that we would submit all the arch/tile/ code up to the community, including the code that couldn't yet be enabled due to missing architecture-independent support. Adding the architecture-independent code would then be done in a separate patch thread. But this leaves the Tilera architecture-dependent code present in the initial submission. How confusing do you think this situation would be? I could just run our code through an unifdef to remove things tagged with CONFIG options that can't be enabled due to missing architecture-independent support.

I think the simpler the initial code gets, the better. Anything that you cannot even compile because of other dependencies just makes the code harder to review.

Quoted 11 lines
Quoted 10 lines

Review

Quoted 5 lines
(quoted diff) +4 -0
+choice
+	depends on EXPERIMENTAL
+	prompt "Memory split" if EMBEDDED
+	default VMSPLIT_3G

I would recommend leaving out this option on your architecture because of the craziness. If I understand you correctly, the CPUs are all 64 bit capable, so there is little point in micro-optimizing the highmem case.

Quoted 3 lines

No, our current shipping hardware is 32-bit only. The next generation is 64-bit capable so does not use HIGHMEM and doesn't need to allow the craziness. I added a "depends on !TILEGX" to disable it in that case.

Ah, I see. If you think people will want to tweak this option then, it should just stay in.

Quoted 10 lines
Quoted 9 lines

Review

Quoted 7 lines
(quoted diff) +6 -0
+config XGBE_MAIN
+	tristate "Tilera GBE/XGBE character device support"
+	default y
+	depends on HUGETLBFS
+	---help---
+	  This is the low-level driver for access to xgbe/gbe/pcie.

This should go to drivers/net/Kconfig.

Quoted 7 lines

Maybe not. This driver is just a character device that allows a user process to talk to the networking hardware directly. For example, you might have an eth0 that is just a normal PCI device using the platform-independent networking code, and then have user-space code driving the 10 Gb on-chip NICs without involving the kernel networking stack. The Linux networking support (tagged with XGBE_NET) is layered on top of this driver.

Ah, I missed the part about this being a character device driver. I meant that the network driver should go to drivers/net/xgbe/, but it probably also makes sense to keep it together with the 'main' driver.

My initial impression from the chardev interface here is that it may be better to do this as a new socket family that lets you open a very-raw socket on the eth0 to do this instead of a chardev, but that discussion belongs on the netdev list.

Quoted 12 lines
Quoted 11 lines

arch/tile/feedback/cachepack.c

Quoted 3 lines
arch/tile/feedback/cachepack.c +0 -0
[...]

This file looks like mixed kernel/user code, which is something we don't normally do. It also does not follow kernel coding style. I'd suggest splitting the implementation and having the kernel version only include the necessary code without all the #ifdef and in normal style.

You could also leave this out for now.

Quoted 6 lines

Yes, for now I'll just leave this feedback-compilation support out. In another place we have stack backtracing support that is also shared, but we can actually just unifdef the file when we install it in the kernel tree, so there will be some blank lines (to make it easier to use line-number information on the original source) but no __KERNEL__ ifdefs in the kernel source.

I've seen the empty lines in some places and found them rather confusing. I also don't think that you will be able to use the line numbers in the way you hope to, because of patches that other people apply to their kernels.

Quoted 11 lines
Quoted 10 lines

arch/tile/include/arch/abi.h

Quoted 3 lines
arch/tile/include/arch/abi.h +0 -0
[...]

This file uses nonstandard formatting of the comments. Is it a generated file, or something that needs to be shared with other projects?

If it is not shared with anything that strictly mandates the style, I'd recommend moving to regular kernel style.

Quoted 7 lines

I'll discuss changing the style with the rest of the Tilera software team. However, we have generally preferred C99 comments for our own non-Linux code, and this "arch/tile/include/arch/" directory represents part of the set of headers that provide access to all the grotty details of the underlying hardware architecture, so can be used within Linux code, or hypervisor code, booter, user space, etc etc, with no libc or kernel header inclusion dependencies.

I see. Many people have tried sharing code between the kernel and other projects, but because of the churn from random people patching it, this usually results in eventually giving up and letting them diverge, or declaring the Linux version to be the master copy and following our coding style everywhere.

Quoted 4 lines

For what it's worth, there do seem to be plenty of files in the architecture-dependent parts of the kernel, and drivers, that use C99 comments, so there is some precedent for leaving this files in that style. (grep "^//" hits 866 files, for example.)

We're slowly getting rid of them ;-)

Quoted 13 lines
Quoted 12 lines

arch/tile/include/arch/abi.h

Quoted 6 lines
arch/tile/include/arch/abi.h +4 -0
+//! Get the current cycle count.
+//!
+static __inline unsigned long long
+get_cycle_count(void)
[...]

I would not use these functions directly in driver code. You could move all of cycle.h to timex.h and rename get_cycle_count to get_cycles. The other functions are not used anywhere, so they don't need to be part of the header.

Quoted 6 lines

This is another artifact of how we are sharing code between our <arch> headers and Linux. Other parts of our code base use these headers too, so we export the correct clock-capture algorithm here, then instantiate it once for Linux, in arch/tile/kernel/time.c. On our 64-bit chip, the CHIP_HAS_SPLIT_CYCLE() #define is false, so we just directly use the trivial implementation in <arch/cycle.h>.

I see. In general, I'd still recommend avoiding these headers if they only add another indirection (like the inline.h), but I understand your reasoning here, so feel free to ignore my recommendation on this one.

Quoted 8 lines
Quoted 4 lines

You should also implement read_current_timer using this so you can avoid the expensive delay loop calibration at boot time.

We have the following in <asm/timex.h>, which I think should already do what you are saying:

Quoted 6 lines

#define ARCH_HAS_READ_CURRENT_TIMER
static inline int read_current_timer(unsigned long *timer_value)

{
        *timer_value = get_cycle_count_low();
        return 0;
}

Ok, I missed that.

Quoted 4 lines

We actually have a one-line change to init/calibrate.c to use an arch_calibrate_delay_direct() macro if defined, which avoids even having to use read_current_timer(), but since that's platform-independent code, I didn't want to get into it yet.

I believe the recommended way to do this is to disable CONFIG_GENERIC_CALIBRATE_DELAY and provide an architecture specific calibrate_delay function.

Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
arch/tile/include/arch/abi.h +8 -0
+/* Use __ALWAYS_INLINE to force inlining, even at "-O0". */
+#ifndef __ALWAYS_INLINE
+#define __ALWAYS_INLINE __inline __attribute__((always_inline))
+#endif
+
+/* Use __USUALLY_INLINE to force inlining even at "-Os", but not at "-O0". */
+#ifndef __USUALLY_INLINE
+#ifdef __OPTIMIZE__
Quoted 8 lines

arch/tile/include/arch/abi.h

Quoted 6 lines
arch/tile/include/arch/abi.h +5 -0
+#define __USUALLY_INLINE __ALWAYS_INLINE
+#else
+#define __USUALLY_INLINE
+#endif
+#endif

Please get rid of these abstraction, inlining is already hard enough with the macros we have in the common code.

Quoted 8 lines

Yes, I've seen some of the inlining wars go by over the years on Linux forums. But again, these headers are meant to be used in places that don't have access to internal Linux headers, while at the same time being easy to #include within code that does use the Linux headers. We could do some crazy transformation of our <arch> headers and install them as "asm" headers for Linux, or something like that, but then it gets harder to write code that can be used both inside Linux and outside (say, in a user-mode driver, or in the hypervisor).

Well, I guess the easiest way out for you would be to kill both inline.h and cycle.h from your kernel code as I suggested. They are reasonably simple anyway. The only other use is in arch/sim.h and I would guess that you can just turn that into __inline to avoid further discussion.

Quoted 11 lines
Quoted 1 line

Do you really need to export user.h and page.h?

We definitely don't need user.h any more; for a while we were building strace to include it, but we haven't been for a while. We do use <asm/page.h> to get the page size in some places, but we could also provide that directly via libc in <sys/page.h> and not involve the kernel. Our build allows tuning the page size but only by recompiling the hypervisor and Linux both, so we just provide page size as a constant. (Though getpagesize() still uses the auxv value passed to user space, just in case we make page size dynamic at some point in the future.)

You cannot use the kernel headers to export build options to user space, because that breaks the user ABI -- anything built against the page.h for one page size will not work reliably on another kernel as it should.

I've forgotten the details, but I think the only reliable way to find out the page size from user space is sysconf().

Quoted 11 lines
Quoted 10 lines

arch/tile/include/asm/asm.h

Quoted 6 lines
arch/tile/include/asm/asm.h new file +0 -0
new file mode 100644
index 0000000..f064bc4

Can be removed. syscall_table.S is the only user (of just one of its macros), so just change that file to not rely on the header.

Quoted 3 lines

Well, true, but it's a good abstraction. I actually was planning to use _ASM_EXTABLE in some of our assembly code, though I hadn't gotten around to doing so yet.

Then just add it back as you start using it. Unused code is by definition untested and that means it's likely to be broken anyway.

Quoted 9 lines
Quoted 8 lines

arch/tile/include/asm/atomic.h

Quoted 2 lines
arch/tile/include/asm/atomic.h +0 -0

This file looks mostly generic, and is to a large extent the same as the existing asm-generic/atomic.h. Could you add an #ifdef atomic_add_return to the definition of that in the generic file and use that, overriding the functions that need to be architecture specific on SMP systems?

Quoted 4 lines

Seems like a good idea. I'll look into it. Should I submit the <asm-generic/atomic.h> change first as an independent change from the Tilera architecture stuff, or just include it with the Tilera stuff? Same question for the bitops stuff that you mention later on.

I would do a separate patch for each header you touch (a combined one for the bitops), and then do the whole architecture last.

Quoted 5 lines
Quoted 4 lines

It's unclear why part of atomic.h is split out into atomic_32.h, especially when the file actually contains the definitions for atomic64_t ;-).

Quoted 9 lines

Yeah, that nomenclature does end up a little confusing. We adopted the x86 confusion of using "_32" for our 32-bit architecture (i386 <=> tilepro) and "_64" for our 64-bit architecture (x86_64 <=> tilegx). So here, <asm/atomic_32.h> is the atomic support for our 32-bit architecture, and <asm/atomic_64.h> is the support for our 64-bit architecture. However, I unifdef'ed out the things tagged with "__tilegx__" in our sources, and removed the "*_64.[chS]" files, since the TILE-Gx support is not 100% until we actually start shipping the silicon.

Ok, I see. Is there anything confidential in the 64 bit code, or is it just not stable yet? If you are allowed to show the code already, I'd suggest also submitting it now, you can always get it working later.

It's probably a good idea to send the 64 bit architecture stuff as a separate patch, since you've already gone through the work of splitting it out. Just mark CONFIG_64BIT as 'EXPERIMENTAL' if you don't consider it ready.

Quoted 10 lines
Quoted 9 lines

arch/tile/include/asm/atomic.h

Quoted 5 lines
arch/tile/include/asm/atomic.h +4 -0
+static inline void set_bit(unsigned nr, volatile unsigned long *addr)
+{
+	_atomic_or(addr + BIT_WORD(nr), BIT_MASK(nr));
+}

+#include <linux/compiler.h>
Why not just declare set_bit (and other functions from here) to be extern?

Quoted 7 lines

Two reasons. The first is that by exposing the "nr" value here, the compiler can often optimize it away completely, or just convert it to an appropriate constant. If we left it in an extern set_bit() the cpu would always have to do the shifts and adds. Or, if not a constant, the compiler can often use an empty slot in one of our "instruction bundles" leading up to the call to _atomic_or() to hide the construction of the necessary pointer and constant.

ok

Quoted 11 lines
Quoted 6 lines

arch/tile/include/asm/atomic.h

Quoted 4 lines

+++ b/arch/tile/include/asm/bitsperlong.h

arch/tile/include/asm/atomic.h +2 -0
+
+# define __BITS_PER_LONG 32

This seems wrong, unless you support _only_ 32 bit user space.

For the current silicon, we do. For the 64-bit silicon, we support either flavor, and we use #ifdef __LP64__ to guard this here. But I'm also unifdef'ing with -U__LP64__ for the sources you're seeing. Perhaps this just ends up being more, rather than less, confusing!

yes.

Quoted 12 lines
Quoted 5 lines

with CONFIG_COMPAT support yet, so tile would be the first one. I think you should just move this file to include/asm-generic/compat.h and use that, so future architectures don't need to define their own.

Most of it is pretty generic, for sure. Are you comfortable with the part about registers? We use 64-bit registers in our 32-bit mode, since for us "compat" mode is just a 32-bit pointer mode, like DEC Alpha's. So "long long" and "double" are still held in a single 64-bit register regardless. Here's the relevant part:

Quoted 4 lines

/* We use the same register dump format in 32-bit images. */ typedef unsigned long compat_elf_greg_t;
#define COMPAT_ELF_NGREG (sizeof(struct pt_regs) / sizeof(compat_elf_greg_t)) typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG];

Ah, I didn't notice those. Just leave out the elf_greg_t stuff from asm-generic/compat.h then and put them either in your own compat.h or into the elf.h, as you like.

Quoted 13 lines
Quoted 12 lines

arch/tile/include/asm/atomic.h

Quoted 8 lines

+ * Idle the core for 8 * iterations cycles.
+ * Also make this a compiler barrier, as it's sometimes used in
+ * lieue of cpu_relax(), which has barrier semantics.
+ */

arch/tile/include/asm/atomic.h +2 -0
+static inline void
+relax(int iterations)
[...]

I'd rather not make this part of the interface. Just move this definition to your spinlock_32.c file and use an open-coded version in delay.c

Quoted 4 lines

We also use this in spinlock_64.c, which of course you didn't see :-) We could just move it to asm/spinlock.h and call it __relax() or some such to suggest that it's not meant to be used by other code. How does that sound?

Yes, maybe even __spinlock_relax() to be more explicit.

Quoted 12 lines
Quoted 5 lines

+++ b/arch/tile/include/asm/kmap_types.h

Any reason for having your own copy of this instead of the generic file?

Yes, it's because we are concerned about chewing up address space. Each additional km type here requires another page worth of address space per cpu, and since we are using 64KB pages for TLB efficiency in our embedded apps, this means 64KB times 64 processors = 4 MB of address space per km type. (Yes, I've followed the discussions about why large page sizes are bad for general-purpose computing.)

I see, that makes sense. It also puts an end to my plans to unify all kmap_types.h implementations, but that doesn't need to worry you.

Quoted 5 lines
Quoted 1 line

This looks like you can use the asm-generic/mman.h file.

No, the bit values for the constants are wrong. We use bits 0x8000 and up to describe our "homecache" overrides to mmap().

Quoted 7 lines
Quoted 4 lines

Since the file is exported to user space, the map_cache stuff probably should not be here, but get moved to a different header that is private to the kernel.

It's part of the optional extended API for mmap() used by Tilera Linux, so it is actually needed by userspace.

Ah, that's unfortunate. How bad would it be for you to come up with a different ABI for the homecache version? I don't have all the facts but my feeling is that the mmap API should not be touched by this and that it better fits into an extension of the numa syscalls, specifically the set_mempolicy/mbind/move_pages family.

Quoted 7 lines
Quoted 3 lines

+++ b/arch/tile/include/asm/posix_types.h Anything wrong with the asm-generic version of this file?

I somehow missed being aware of the generic version of this (and of sembuf.h and shmparam.h). It seems likely we can use the generic posix_types.h, and we can certainly use the generic forms of the others.

ok, good.

Quoted 18 lines
Quoted 8 lines
Quoted 8 lines
arch/tile/include/asm/sigcontext.h new file +6 -0
+
+#ifndef _ASM_TILE_SIGCONTEXT_H
+#define _ASM_TILE_SIGCONTEXT_H
+
+/* NOTE: we can't include <linux/ptrace.h> due to #include dependencies. */
+#include <asm/ptrace.h>
Quoted 9 lines

arch/tile/include/asm/sigcontext.h

Quoted 7 lines
arch/tile/include/asm/sigcontext.h new file +6 -0
+
+/* Must track <sys/ucontext.h> */
+
+struct sigcontext {
+	struct pt_regs regs;
+};

The comments both do not match the code apparently.

Quoted 1 line

Sorry - can you clarify this comment? I don't see the mismatch.

Nevermind.

The first one I just misread. I only saw that the comment said 'cannot include ptrace.h' but then includes it anyway.

For the second one, I assumed that sys/ucontext.h would include the definition from asm/ucontext.h, which it does not.

Quoted 9 lines
Quoted 3 lines

+++ b/arch/tile/include/asm/stat.h
part of the ABI, please don't define your own.

Unfortunately, changing this would require us to make an incompatible change to current user-space. It may be possible anyway, since we are planning a number of transitions for our next major release (jump from kernel 2.6.26, switch from our current SGI-derived compiler to using gcc, etc.). I'll discuss this internally.

I believe that in the process of getting upstream, many things will end up incompatible, so this is your only chance to ever fix the ABI.

Quoted 8 lines
Quoted 7 lines

arch/tile/include/asm/sigcontext.h

Quoted 3 lines
arch/tile/include/asm/sigcontext.h new file +2 -0
+/* Use this random value, just like most archs.  Mysterious. */
+#define CLOCK_TICK_RATE	1193180 /* Underlying HZ */

long story. It should however actually be something related to the your frequency, not the time base of the i8253 chip that I hope you are not using.

Quoted 5 lines

No, no i8253. But our clock tick rate is controllable dynamically at boot, so there's certainly no trivial constant that makes sense here. Should I use the slowest possible frequency here? The fastest? It's used in some irrelevant drivers, but also in <linux/jiffies.h>, which is the place that worries me.

The drivers all should not be using it, actually. The patch I did for this apparently got lost somewhere, I'll need to dig it out again.

The calculation in linux/jiffies.h tries to figure out how wrong the timer tick is because of the mismatch between 1193180 (or 1193182) HZ and the desired 100/250/1000 HZ frequency, and correct that mismatch.

A reasonable value would be something that is a multiple of the possible HZ values (100, 250, 1000) and a fraction of the possible hw timer frequencies.

Quoted 14 lines
Quoted 7 lines

Your unistd.h file contains syscall numbers for many calls that you should not need in a new architecture. Please move to the asm-generic/unistd.h file instead. There may be a few things you need to do in libc to get there, but this version is no good. If you have problems with asm-generic/unistd.h (or any of the other asm-generic files), feel free to ask me for help.

Sounds like we should take this one off-list until I know more precisely what you're worried about. As far as I know, I did not import any pointless syscalls. I have a stanza (which of course is unifdef'ed out of your version) that removes all the foo64() syscalls when used with 64-bit userspace. But I think all the rest are useful.

Quoted 3 lines

As for <asm-generic/unistd.h>, I'll look more carefully at it, though of course using it is also dependent on whether it is reasonable for us to completely break compatibility with current user-space programs.

Any change in there would break the user ABI, obviously, though there are two ways to do that though: You could either keep the existing numbers so that applications using the limited set can still run on old kernels or use the numbers from asm-generic/unistd.h, which pretty much guarantees that every single binary application becomes incompatible. Note that you also get silent breakage from any change in the ABI headers (stat.h, types.h, ...), so a clear cut may end up being the better option if you are already changing the ABI.

Note that the asm-generic version defines 244 numbers, while you have a total of 313 numbers. You obviously need the extra arch specific syscalls (e.g cmpxchg), so we need to reserve some space for those in the generic header. All the other ones that are in your version but not in the generic version are very likely not needed (unless I made a mistake in the generic code).

Specifically:

- anything that needs a '__ARCH_WANT_SYS_*' definition is deprecated and has been replaced by a new syscall. The exceptions are RT_SIGACTION, RT_SIGSUSPEND, STAT64 and LLSEEK (the latter only on 32 bit), these should be changed in some way to invert the logic.

- You do not need both the 32 bit and 64 bit version of syscalls taking an off_t/loff_t argument like fcntl. Just define one syscall number and assign it to one or the other syscall so you always get a 64 bit argument (off_t on 64 bit, loff_t on 32 bit).

- some calls recently got a new version (pipe/pipe2, dup2/dup3). You only need one in the kernel, while the older one can be implemented in user space.

- many file based syscalls now have an 'at' version (openat, linkat, ...) that takes an extra argument, similar to the previously mentioned ones, you can implement the old behavior in user space.

Quoted 3 lines

Arnd - MANY thanks for your careful review so far. I will implement what you suggested and await the remainder of your review before resubmitting patches.

You're welcome. I'll also try to have a look at the remaining files in arch/tile/{lib,mm,kernel} next.

Arnd

#11 lore raw
Quoted 4 lines · Arnd Bergmann

I would also like to wait for another opinion before it goes in. Note that the regular procedure is to have the code reviewed before the start of the merge window, not in the middle of it!

Ack! My mistake, sorry. I was under the impression that I should wait for the churn on the list to die down a bit after the stable release (in this case 2.6.34) before trying to send big batches of new code into LKML.

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

Since the file is exported to user space, the map_cache stuff probably should not be here, but get moved to a different header that is private to the kernel.

It's part of the optional extended API for mmap() used by Tilera Linux, so it is actually needed by userspace.

Quoted 7 lines

Ah, that's unfortunate. How bad would it be for you to come up with a different ABI for the homecache version? I don't have all the facts but my feeling is that the mmap API should not be touched by this and that it better fits into an extension of the numa syscalls, specifically the set_mempolicy/mbind/move_pages family.

Interesting idea. I'll consider how straightforward this would be to do.

Quoted 4 lines
Quoted 4 lines

As for <asm-generic/unistd.h>, I'll look more carefully at it, though of course using it is also dependent on whether it is reasonable for us to completely break compatibility with current user-space programs.

I think the discussion internally supports breaking backwards compatibility; this will after all be aligned with our 3.0 release eventually, which is when we are also switching compilers to gcc. So I'll see what is involved in the kernel and libc in switching to <asm-generic/unistd.h> and get back to you with more detailed comments if necessary.

Quoted 4 lines

Note that the asm-generic version defines 244 numbers, while you have a total of 313 numbers. You obviously need the extra arch specific syscalls (e.g cmpxchg), so we need to reserve some space for those in the generic header.

Yes, although cmpxchg is actually a negative syscall value, which we use to save every last cycle on that path -- it doesn't do any of the usual syscall processing at all, just basically takes advantage of the kernel lock infrastructure.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#12 lore raw
In reply to Arnd Bergmann
Quoted 7 lines · Arnd Bergmann

Note that the asm-generic version defines 244 numbers, while you have a total of 313 numbers. You obviously need the extra arch specific syscalls (e.g cmpxchg), so we need to reserve some space for those in the generic header. All the other ones that are in your version but not in the generic version are very likely not needed (unless I made a mistake in the generic code).

I looked at the diff of the set of syscalls you provide and the ones we've been using.

Specific questions:

- How do you propose representing the architecture-specific syscalls? We have three "very special" syscalls that are negative numbers, which I won't worry about, since they'll be out of the normal numbering sequence. But we also have a few others (cmpxchg_baddr, raise_fpe, flush_cache) that we'll need a numbering location for. I see that you already have an empty block from 244 (today) to 1023; perhaps architectures should just use 1023 on down? I'll do this for now.

- You renamed __NR__llseek to __NR_llseek, which of course seems pretty reasonable, but libc expects to see the former (both glibc and uclibc). Is it worth requiring non-standard libc code? I may just add __NR__llseek as an alias in my unistd.h for now.

- Are you planning to keep all the ifdef'ed syscalls going forward? Because honestly, I'd rather just enable __ARCH_WANT_SYSCALL_NO_AT, etc., and use the kernel implementations, since otherwise I'll have to go into both uclibc and glibc and add a bunch of extra Tilera-specific code and then try to push that up to their community, when really I just want to have the Tilera architecture userspace support be as generic as possible.

The result seems positive overall; I'm certainly happy to dump, e.g., "nice" and "stime", since they have obvious userspace wrappers (and in fact libc is already geared up to use them if available). And a few other syscalls in the Tile list aren't even implemented but were just brought over from x86 "in case", like afs_syscall, putpmsg, and getpmsg, so I'm happy to abandon them as well. And "sysfs" is commented out of uclibc, and not present in glibc, so no big loss there. Other than that I think the set of supported syscalls will only change by a couple -- and more importantly, from my point of view, Tilera gets to stay automatically synced to any new syscalls added to Linux going forward. So this is good.

I assume that folks are committing to not changing any of the existing numbers, ifdefs, etc. in asm-generic/unistd.h; if we're the only architecture using it, no one might notice until we did. :-)

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
maintainer
#13 lore raw
Quoted 5 lines · Chris Metcalf

I looked at the diff of the set of syscalls you provide and the ones we've been using.

Specific questions:

Quoted 7 lines

- How do you propose representing the architecture-specific syscalls? We have three "very special" syscalls that are negative numbers, which I won't worry about, since they'll be out of the normal numbering sequence. But we also have a few others (cmpxchg_baddr, raise_fpe, flush_cache) that we'll need a numbering location for. I see that you already have an empty block from 244 (today) to 1023; perhaps architectures should just use 1023 on down? I'll do this for now.

I would keep allocating from the bottom. For now, maybe we should just reserve 16 arch specific syscall numbers starting at 244, and add

#define __NR_tile_cmpxchg_baddr (__NR_arch_specific_syscall + 0)
#define __NR_tile_raise_fpe (__NR_arch_specific_syscall + 1)
#define __NR_tile_flush_cache (__NR_arch_specific_syscall + 2)

to your own unistd.h.

Quoted 4 lines

- You renamed __NR__llseek to __NR_llseek, which of course seems pretty reasonable, but libc expects to see the former (both glibc and uclibc). Is it worth requiring non-standard libc code? I may just add __NR__llseek as an alias in my unistd.h for now.

That was probably just a mistake on my side. The only other architecture using the generic version so far is score, so maybe Chen Liqin can comment on how he dealt with this and if he depends on the definition now.

Quoted 7 lines

- Are you planning to keep all the ifdef'ed syscalls going forward? Because honestly, I'd rather just enable __ARCH_WANT_SYSCALL_NO_AT, etc., and use the kernel implementations, since otherwise I'll have to go into both uclibc and glibc and add a bunch of extra Tilera-specific code and then try to push that up to their community, when really I just want to have the Tilera architecture userspace support be as generic as possible.

The idea was to only have them around as a transitional helper for new architectures while getting merged, but nothing should ever use these in production.

While glibc and uclibc are currently still lacking support for these, the intention was for both to provide the wrappers in the architecture independent code like they already do for a lot of other system calls. Maybe Ulrich can comment on how we would get there, in particular if we would want to add those helpers to glibc himself or if he would prefer you to send a patch to do that.

There really should be no code required in glibc to deal with the generic ABI, other than the parts that deal with the specific register layout and calling conventions. We're not there yet, but my hope is that tile is the last architecture that needs to worry about this and once you get it working with common code, future architectures just work.

Quoted 11 lines

The result seems positive overall; I'm certainly happy to dump, e.g., "nice" and "stime", since they have obvious userspace wrappers (and in fact libc is already geared up to use them if available). And a few other syscalls in the Tile list aren't even implemented but were just brought over from x86 "in case", like afs_syscall, putpmsg, and getpmsg, so I'm happy to abandon them as well. And "sysfs" is commented out of uclibc, and not present in glibc, so no big loss there. Other than that I think the set of supported syscalls will only change by a couple -- and more importantly, from my point of view, Tilera gets to stay automatically synced to any new syscalls added to Linux going forward. So this is good.

ok.

Quoted 3 lines

I assume that folks are committing to not changing any of the existing numbers, ifdefs, etc. in asm-generic/unistd.h; if we're the only architecture using it, no one might notice until we did. :-)

There is also score using it, but yes, we try very hard not to break the ABI and any patch modifying these files normally gets posted to the linux-arch and/or linux-api mailing lists that you should probably subscribe to as well.

Arnd

#14 lore raw
Quoted 9 lines · Arnd Bergmann

I would keep allocating from the bottom. For now, maybe we should just reserve 16 arch specific syscall numbers starting at 244, and add

#define __NR_tile_cmpxchg_baddr (__NR_arch_specific_syscall + 0)
#define __NR_tile_raise_fpe (__NR_arch_specific_syscall + 1)
#define __NR_tile_flush_cache (__NR_arch_specific_syscall + 2)

to your own unistd.h.

OK.

Quoted 4 lines

The idea was to only have them around as a transitional helper for
new architectures while getting merged, but nothing should ever use these in production.

Perhaps the best strategy for Tile for now is to enable the transitional helpers, and then when glibc no longer requires any of those syscalls, we can remove them from the kernel. If this happens in the relatively short term (e.g. before our 3.0 release later this year) all the better, but for now we can separate this into a first change that preserves most of the compatibility syscalls, and work towards remove them in a later release.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
maintainer
#15 lore raw
Quoted 5 lines · Chris Metcalf
Quoted 4 lines

The idea was to only have them around as a transitional helper for
new architectures while getting merged, but nothing should ever use these in production.

Quoted 7 lines

Perhaps the best strategy for Tile for now is to enable the transitional helpers, and then when glibc no longer requires any of those syscalls, we can remove them from the kernel. If this happens in the relatively short term (e.g. before our 3.0 release later this year) all the better, but for now we can separate this into a first change that preserves most of the compatibility syscalls, and work towards remove them in a later release.

I don't like the idea of adding syscalls first and then disabling them again. We tried that on score and now we're stuck with the wrong syscall table there because they never got removed.

Instead, I'd suggest you do the minimal syscall table for upstream and just carry a private patch to enable the other syscalls until you get a working glibc/eglibc/uclibc with the official kernel.

Arnd

#16 lore raw
In reply to Arnd Bergmann

Arnd Bergmann <[email protected]> 写于 2010-05-25 23:03:11:

Quoted 2 lines
Quoted 2 lines

- You renamed __NR__llseek to __NR_llseek, which of course seems

pretty

Quoted 1 line
Quoted 1 line

reasonable, but libc expects to see the former (both glibc and

uclibc).

Quoted 8 lines
Quoted 2 lines

Is it worth requiring non-standard libc code? I may just add __NR__llseek as an alias in my unistd.h for now.

That was probably just a mistake on my side. The only other architecture using the generic version so far is score, so maybe Chen Liqin can comment on how he dealt with this and if he depends on the definition now.

When we port glibc to score arch, we fixed the llseek.c file, remove the underscore before llseek. maybe it has compatible problems, but it work ok with score application.

34c34
< return (loff_t) (INLINE_SYSCALL (_llseek, 5, fd, (off_t) (offset >>
32),
---

Quoted 1 line

return (loff_t) (INLINE_SYSCALL (llseek, 5, fd, (off_t) (offset >>

32),

--
liqin

#17 lore raw
Quoted 8 lines · On 5/25/2010 10:44 PM, [email protected] wrote:

Arnd Bergmann <[email protected]> at 2010-05-25 23:03:11

Quoted 7 lines
Quoted 7 lines

- You renamed __NR__llseek to __NR_llseek, which of course seems pretty

reasonable, but libc expects to see the former (both glibc and uclibc).

Is it worth requiring non-standard libc code? I may just add __NR__llseek as an alias in my unistd.h for now.

Quoted 9 lines
Quoted 5 lines

That was probably just a mistake on my side. The only other architecture using the generic version so far is score, so maybe Chen Liqin can comment on how he dealt with this and if he depends on the definition now.

When we port glibc to score arch, we fixed the llseek.c file, remove the underscore before llseek. maybe it has compatible problems, but it work ok with score application.

This sounds like the right solution for the generic code too, but presumably it would need some kind of "#if !defined(__NR_llseek) && defined(__NR__llseek)" hackery in the llseek.c common code in glibc. Ulrich, does that seem like the right direction for you?

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#20 lore raw

On 5/25/2010 11:21 AM, Arnd Bergmann wrote (in private email):

Quoted 4 lines

I just realized that the the sys_call_table is not yet being generated automatically. The code is only present in arch/score/kernel/sys_call_table.c.

Quoted 9 lines

To do this correctly, you should take that file and put it into kernel/sys_call_table.c, configured with CONFIG_GENERIC_SYSCALLTABLE, which you then enable in your arch/tile/Kconfig.
The unistd.h is also missing the compat syscall table entries. It would be good to extend the macros to cover that as well, similar to how it's done in arch/powerpc/include/asm/systbl.h.

The hard part to applying this approach turned out to be the COMPAT code for our 64-bit platform. The approach I am using now is to extend <linux/compat.h> with all the compat syscalls that are not currently prototyped, and then to include a a set of #defines that allow all the compat syscalls to be invoked as "compat_sys_foo()", e.g.

+/* Standard Linux functions that don't have "compat" versions. */ +#define compat_sys_accept sys_accept
+#define compat_sys_accept4 sys_accept4
+#define compat_sys_access sys_access
+#define compat_sys_acct sys_acct
[...]
+#define compat_sys_uselib sys_uselib
+#define compat_sys_vfork sys_vfork
+#define compat_sys_vhangup sys_vhangup
+#define compat_sys_write sys_write

With that in place, you can then use the "arch/score" mechanism to generate not just the main syscall table, but the compat table as well, by doing something like this:

+#undef __SYSCALL
+#define __SYSCALL(nr, call) [nr] = (compat_##call), +
+void *compat_sys_call_table[__NR_syscalls] = {
+ [0 ... __NR_syscalls-1] = sys_ni_syscall,
+#include <asm/unistd.h>
+};

To make this really work out, I also had to add a __SYSCALL_COMPAT notion to <asm-generic/unistd.h>; when this is set, the __NR_xxx values and the __SYSCALL stuff are set up as if for a 32-bit platform, even if the real platform is 64-bit, so that the header can be used to create the compat_sys_call_table[] properly.

I fixed a few other minor glitches too, like the fact that we need sys_fadvise64_64 to be the "primary" syscall even in the 64-bit case (not sys_fadvise64), and adding an __ARCH_WANT_SYNC_FILE_RANGE2 flag to the generic ABI so platforms can request the use of that flavor of the ABI instead. (It makes a difference on our platform.) And I took Arnd's suggestion and added 16 architecture-specific syscalls from 244 to 259.

Note that it turns out not to be quite right to make the sys_call_table.c a generic file, at least in our case, since you really want to allow tweaking the actual syscall functions as part of generating the sys_call_table[] array. For example, on our 32-bit platforms some of the 64-bit syscalls need wrappers since otherwise there is a mismatch between the generic code in libc that splits 64-bit values into 32-bit registers, and the actual registers pairs used by our ABI for native 64-bit values. In any case it's only half a dozen lines of common code. And in compat mode there are additional overrides you want, such as using sys_newstat() for compat_sys_stat64(), if your architecture will tolerate it, etc.

I'll send a complete patch later once I've finished digesting all the various suggestions folks have sent, but this was a big enough piece that I thought I'd at least summarize the design back to LKML in case people would care to comment.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#21 lore raw
In reply to Chris Metcalf
Quoted 4 lines · Chris Metcalf
Quoted 2 lines · Arnd Bergmann

The notable exception is pci, which should go to arch/tile/pci but still be reviewed in the pci mailing list.

Quoted 10 lines

So this is an interesting question. Currently the "device driver" support in the arch/tile/drivers directory is for devices which exist literally only as part of the Tilera silicon, i.e. they are not separable from the tile architecture itself. For example, the network driver is tied to the Tilera networking shim DMA engine on the chip. Does it really make sense to move this to a directory where it is more visible to other architectures? I can see that it might from the point of view of code bombings done to network drivers, for example. Similarly for our other drivers, which are tied to details of the hypervisor API, etc.

It also depends what precisely your goal with arch/tile/drivers is. In the sh case I started out with an arch/sh/pci and then migrated to an arch/sh/drivers/ model when we started having to support various bus operations similar to PCI. Anything common or shared on the other hand gets pushed in to drivers/sh/ directly.

These days there is also a drivers/platform/<arch> abstraction which you could easily use for platform-specific drivers that aren't things like CPU/board-specific bus operations/fixups.

Quoted 7 lines
Quoted 6 lines

arch/tile/include/asm/addrspace.h

Quoted 3 lines
arch/tile/include/asm/addrspace.h new file +0 -0

This file is not referenced anywhere. I'd suggest removing it until you send code that actually uses it.

Quoted 8 lines

OK, I've removed it. I assumed that it was required by architectures, since it is used in various places in the kernel. I see four drivers that just include it unconditionally at the moment, though curiously, they don't seem to use any of the symbols it defines. And there are four architectures (avr32, m32r, mips, sh) that all provide this header at the moment, though there doesn't seem to be agreement as to what symbols it should define.

To give a bit of background on this..

All of these platforms provide this header for legacy reasons, and it's not a road you want to go down. Its primary purpose was to provide definitions for memory segments, and specifically wrappers for flipping between them. For platforms that have 1:1 cached/uncached mappings for lowmem in different segments, old drivers used to commonly toggle the high bits of an address to determine whether access was cached or not. These days any driver that has knowledge of memory segmentation is almost certainly doing something wrong.

If you need to support this sort of thing, then you ideally want to hide the segmentation information in your ioremap() implementation (you can look at what arch/sh/include/asm/io.h does for its ioremap cases, and we have a wide variety of corner cases outside of legacy segmentation).

These platforms have also traditionally had these segments bypass the MMU completely, so while you don't take page faults for lowmem, you can't reuse parts of the address space in untranslatable holes. Some architectures (like sh) have dropped the segmentation entirely for certain MMU modes which permits for things like setting up an uncached mapping for kernel text without enabling drivers to game the system without proper remapping.

maintainer
#22 lore raw
In reply to Arnd Bergmann

Here comes the rest of my review, covering the arch/tile/kernel/ directory. There isn't much to comment on in arch/tile/mm and arch/tile/lib from my side, and I still ignored the drivers and oprofile directories.

Quoted 5 lines
arch/tile/kernel/backtrace.c new file +0 -0
new file mode 100644
index 0000000..3cbb21a

arch/tile/kernel/backtrace.c

Quoted 9 lines
arch/tile/kernel/backtrace.c new file +9 -0
+#ifndef __KERNEL__
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#else
+#include <linux/kernel.h>
+#include <linux/string.h>
+#define abort() BUG()
+#endif

Besides being shared kernel/user code (as you already mentioned), this file looks rather complicated compared to what the other architectures do.

Is this really necessary because of some property of the architecture or do you implement other functionality that is not present on existing archs?

arch/tile/kernel/compat.c

Quoted 12 lines
arch/tile/kernel/compat.c new file +7 -0
new file mode 100644
index 0000000..ca6421c
+/*
+ * Syscalls that take 64-bit numbers traditionally take them in 32-bit
+ * "high" and "low" value parts on 32-bit architectures.
+ * In principle, one could imagine passing some register arguments as
+ * fully 64-bit on TILE-Gx in 32-bit mode, but it seems easier to
+ * adapt the usual convention.
+ */

Yes, that makes sense. You definitely want binary compatibility between 32 bit binaries from a native 32 bit system on TILE-Gx in the syscall interface.

Quoted 33 lines
arch/tile/kernel/compat.c new file +33 -0
+long compat_sys_truncate64(char __user *filename, u32 dummy, u32 low, u32 high)
+{
+	return sys_truncate(filename, ((loff_t)high << 32) | low);
+}
+
+long compat_sys_ftruncate64(unsigned int fd, u32 dummy, u32 low, u32 high)
+{
+	return sys_ftruncate(fd, ((loff_t)high << 32) | low);
+}
+
+long compat_sys_pread64(unsigned int fd, char __user *ubuf, size_t count,
+			u32 dummy, u32 low, u32 high)
+{
+	return sys_pread64(fd, ubuf, count, ((loff_t)high << 32) | low);
+}
+
+long compat_sys_pwrite64(unsigned int fd, char __user *ubuf, size_t count,
+			 u32 dummy, u32 low, u32 high)
+{
+	return sys_pwrite64(fd, ubuf, count, ((loff_t)high << 32) | low);
+}
+
+long compat_sys_lookup_dcookie(u32 low, u32 high, char __user *buf, size_t len)
+{
+	return sys_lookup_dcookie(((loff_t)high << 32) | low, buf, len);
+}
+
+long compat_sys_sync_file_range2(int fd, unsigned int flags,
+				 u32 offset_lo, u32 offset_hi,
+				 u32 nbytes_lo, u32 nbytes_hi)
+{
+	return sys_sync_file_range(fd, ((loff_t)offset_hi << 32) | offset_lo,
+				   ((loff_t)nbytes_hi << 32) | nbytes_lo,

arch/tile/kernel/compat.c

Quoted 10 lines
arch/tile/kernel/compat.c new file +10 -0
+				   flags);
+}
+
+long compat_sys_fallocate(int fd, int mode,
+			  u32 offset_lo, u32 offset_hi,
+			  u32 len_lo, u32 len_hi)
+{
+	return sys_fallocate(fd, mode, ((loff_t)offset_hi << 32) | offset_lo,
+			     ((loff_t)len_hi << 32) | len_lo);
+}

It may be time to finally provide generic versions of these... Any work in that direction would be appreciated, but you may also just keep this code, it's good.

Quoted 12 lines
arch/tile/kernel/compat.c new file +12 -0
+/*
+ * The 32-bit runtime uses layouts for "struct stat" and "struct stat64"
+ * that match the TILEPro/TILE64 runtime.  Unfortunately the "stat64"
+ * layout on existing 32 bit architectures doesn't quite match the
+ * "normal" 64-bit bit layout, so we have to convert for that too.
+ * Worse, it has an unaligned "st_blocks", so we have to use __copy_to_user().
+ */
+
+int cp_compat_stat(struct kstat *kbuf, struct compat_stat __user *ubuf)
+{
+	compat_ino_t ino;
+

arch/tile/kernel/compat.c

Quoted 10 lines
arch/tile/kernel/compat.c new file +9 -0
+	if (!old_valid_dev(kbuf->dev) || !old_valid_dev(kbuf->rdev))
+		return -EOVERFLOW;
+	if (kbuf->size >= 0x7fffffff)
+		return -EOVERFLOW;
+	ino = kbuf->ino;
+	if (sizeof(ino) < sizeof(kbuf->ino) && ino != kbuf->ino)
+		return -EOVERFLOW;
+	if (!access_ok(VERIFY_WRITE, ubuf, sizeof(struct compat_stat)) ||
+	    __put_user(old_encode_dev(kbuf->dev), &ubuf->st_dev) ||
...

With the asm-generic/stat.h definitions, this is no longer necessary. Those are defined to be compatible, so you can just call the 64 bit version of sys_stat in place of the 32 bit sys_stat64.

Quoted 4 lines
arch/tile/kernel/compat.c new file +4 -0
+long compat_sys_sched_rr_get_interval(compat_pid_t pid,
+				      struct compat_timespec __user *interval)
+{
+	struct timespec t;

arch/tile/kernel/compat.c

Quoted 10 lines
arch/tile/kernel/compat.c new file +10 -0
+	int ret;
+	mm_segment_t old_fs = get_fs();
+
+	set_fs(KERNEL_DS);
+	ret = sys_sched_rr_get_interval(pid, (struct timespec __user *)&t);
+	set_fs(old_fs);
+	if (put_compat_timespec(&t, interval))
+		return -EFAULT;
+	return ret;
+}

This is relatively ugly and probably identical to the other six copies of the same function. Someone (not necessarily you) should do this the right way.

Quoted 10 lines
arch/tile/kernel/compat.c new file +10 -0
+
+ssize_t compat_sys_sendfile(int out_fd, int in_fd, compat_off_t __user *offset,
+			    size_t count)
+{
+	mm_segment_t old_fs = get_fs();
+	int ret;
+	off_t of;
+
+	if (offset && get_user(of, offset))
+		return -EFAULT;

arch/tile/kernel/compat.c

Quoted 10 lines
arch/tile/kernel/compat.c new file +10 -0
+
+	set_fs(KERNEL_DS);
+	ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL,
+			   count);
+	set_fs(old_fs);
+
+	if (offset && put_user(of, offset))
+		return -EFAULT;
+	return ret;
+}

compat_sys_sendfile will not be needed with the asm-generic/unistd.h definitions, but I think you will still need a compat_sys_sendfile64, to which the same applies as to compat_sys_sched_rr_get_interval.

Quoted 4 lines

+/*
+ * The usual compat_sys_msgsnd() and _msgrcv() seem to be assuming
+ * some different calling convention than our normal 32-bit tile code.
+ */

Fascinating, the existing functions are useless, because no architecture is actually able to call them directly from their sys_call_table. We should replace those with your version and change the other architectures accordingly.

Quoted 16 lines
arch/tile/kernel/compat_signal.c new file +11 -0
new file mode 100644
index 0000000..e21554e
+
+struct compat_sigaction {
+	compat_uptr_t sa_handler;
+	compat_ulong_t sa_flags;
+	compat_uptr_t sa_restorer;
+	sigset_t sa_mask;		/* mask last for extensibility */
+};
+
+struct compat_sigaltstack {
+	compat_uptr_t ss_sp;
+	int ss_flags;

arch/tile/kernel/compat_signal.c

Quoted 10 lines
arch/tile/kernel/compat_signal.c new file +10 -0
+	compat_size_t ss_size;
+};
+
+struct compat_ucontext {
+	compat_ulong_t	  uc_flags;
+	compat_uptr_t     uc_link;
+	struct compat_sigaltstack	  uc_stack;
+	struct sigcontext uc_mcontext;
+	sigset_t	  uc_sigmask;	/* mask last for extensibility */
+};

It's been some time since I looked at this stuff, so I'd need help from others to review it. I sense that it should be simpler though.

Quoted 36 lines
arch/tile/kernel/compat_signal.c new file +36 -0
+/*
+ * Interface to /proc and the VFS.
+ */
+
+static int hardwall_ioctl(struct inode *inode, struct file *file,
+			  unsigned int a, unsigned long b)
+{
+	struct hardwall_rectangle rect;
+	struct khardwall_rectangle *krect = file_to_rect(file);
+	int sig;
+
+	switch (a) {
+	case HARDWALL_CREATE:
+		if (udn_disabled)
+			return -ENOSYS;
+		if (copy_from_user(&rect, (const void __user *) b,
+				   sizeof(rect)) != 0)
+			return -EFAULT;
+		if (krect != NULL)
+			return -EALREADY;
+		krect = hardwall_create(&rect);
+		if (IS_ERR(krect))
+			return PTR_ERR(krect);
+		_file_to_rect(file) = krect;
+		return 0;
+
+	case HARDWALL_ACTIVATE:
+		return hardwall_activate(krect);
+
+	case HARDWALL_DEACTIVATE:
+		if (current->thread.hardwall != krect)
+			return -EINVAL;
+		return hardwall_deactivate(current);
+
+	case HARDWALL_SIGNAL:
+		if (krect == NULL)

arch/tile/kernel/compat_signal.c

Quoted 10 lines
arch/tile/kernel/compat_signal.c new file +10 -0
+			return -EINVAL;
+		sig = krect->abort_signal;
+		if (b >= 0)
+			krect->abort_signal = b;
+		return sig;
+
+	default:
+		return -EINVAL;
+	}
+}

The hardwall stuff looks like it is quite central to your architecture. Could you elaborate on what it does?

If it is as essential as it looks, I'd vote for promoting the interface from an ioctl based one to four real system calls (more if necessary).

Quoted 23 lines
arch/tile/kernel/compat_signal.c new file +23 -0
+/* Dump a line of data for the seq_file API to print the hardwalls */
+static int hardwall_show(struct seq_file *m, void *v)
+{
+	struct khardwall_rectangle *kr;
+	struct hardwall_rectangle *r;
+	struct task_struct *p;
+	unsigned long flags;
+
+	if (udn_disabled) {
+		if (ptr_to_index(v) == 0)
+			seq_printf(m, "%dx%d 0,0 pids: 0@0,0\n",
+				   smp_width, smp_height);
+		return 0;
+	}
+	spin_lock_irqsave(&hardwall_lock, flags);
+	kr = _nth_rectangle(ptr_to_index(v));
+	if (kr == NULL) {
+		spin_unlock_irqrestore(&hardwall_lock, flags);
+		return 0;
+	}
+	r = &kr->rect;
+	seq_printf(m, "%dx%d %d,%d pids:",
+		   r->width, r->height, r->ulhc_x, r->ulhc_y);

arch/tile/kernel/compat_signal.c

Quoted 10 lines
arch/tile/kernel/compat_signal.c new file +10 -0
+	for_each_hardwall_task(p, &kr->task_head) {
+		unsigned int cpu = cpumask_first(&p->cpus_allowed);
+		unsigned int x = cpu % smp_width;
+		unsigned int y = cpu / smp_width;
+		seq_printf(m, " %d@%d,%d", p->pid, x, y);
+	}
+	seq_printf(m, "\n");
+	spin_unlock_irqrestore(&hardwall_lock, flags);
+	return 0;
+}

Note that the procfs file format is part of your ABI, and this looks relatively hard to parse, which may introduce bugs.
For per-process information, it would be better to have a simpler file in each /proc/<pid>/directory. Would that work for you?

Quoted 12 lines
arch/tile/kernel/compat_signal.c new file +12 -0
+static int hardwall_open(struct inode *inode, struct file *file)
+{
+	/*
+	 * The standard "proc_reg_file_ops", which we get from
+	 * create_proc_entry(), does not include a "flush" op.
+	 * We add it here so that we can deactivate on close.
+	 * Since proc_reg_file_ops, and all its function pointers,
+	 * are static in fs/proc/inode.c, we just copy them blindly.
+	 */
+	static struct file_operations override_ops;
+	if (override_ops.open == NULL) {
+		override_ops = *file->f_op;

arch/tile/kernel/compat_signal.c

Quoted 10 lines
arch/tile/kernel/compat_signal.c new file +10 -0
+		BUG_ON(override_ops.open == NULL);
+		BUG_ON(override_ops.flush != NULL);
+		override_ops.flush = hardwall_flush;
+	} else {
+		BUG_ON(override_ops.open != file->f_op->open);
+	}
+	file->f_op = &override_ops;
+
+	return seq_open(file, &hardwall_op);
+}

As you are probably aware of, this is really ugly. Hopefully it won't be necessary if you can move to actual syscalls.

arch/tile/kernel/compat_signal.c

Quoted 12 lines
arch/tile/kernel/compat_signal.c new file +12 -0
+/* Referenced from proc_tile_init() */
+static const struct file_operations proc_tile_hardwall_fops = {
+	.open		= hardwall_open,
+	.ioctl          = hardwall_ioctl,
+#ifdef CONFIG_COMPAT
+	.compat_ioctl   = hardwall_compat_ioctl,
+#endif
+	.flush          = hardwall_flush,
+	.release        = hardwall_release,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+};

Note that we're about to remove the .ioctl file operation and replace it with .unlocked_ioctl everywhere. Also, as I mentioned in the first review round, ioctl on procfs is something you should never do.

arch/tile/kernel/hugevmap.c

Quoted 5 lines
arch/tile/kernel/hugevmap.c new file +0 -0
new file mode 100644
index 0000000..c408666

Not used anywhere apparently. Can you explain what this is good for? Maybe leave it out for now, until you merge the code that needs it. I don't see anything obviously wrong with the implementation though.

arch/tile/kernel/hv_drivers.c

Quoted 5 lines
arch/tile/kernel/hv_drivers.c new file +0 -0
new file mode 100644
index 0000000..5e69973

Please have a look at drivers/char/hvc_{rtas,beat,vio,iseries}.c to see how we do the same for other hypervisors, in a much simpler way.

Quoted 24 lines
arch/tile/kernel/hv_drivers.c new file +24 -0
+/*
+ * Interrupt dispatcher, invoked upon a hypervisor device interrupt downcall
+ */
+void tile_dev_intr(struct pt_regs *regs, int intnum)
+{
+	int count;
+
+	/*
+	 * Get the device interrupt pending mask from where the hypervisor
+	 * has tucked it away for us.
+	 */
+	unsigned long pending_dev_intr_mask = __insn_mfspr(SPR_SYSTEM_SAVE_1_3);
+
+
+	/* Track time spent here in an interrupt context. */
+	struct pt_regs *old_regs = set_irq_regs(regs);
+	irq_enter();
+
+	for (count = 0; pending_dev_intr_mask; ++count) {
+		if (pending_dev_intr_mask & 0x1) {
+			struct tile_irq_desc *desc = &tile_irq_desc[count];
+			if (desc->handler == NULL) {
+				printk(KERN_ERR "Ignoring hv dev interrupt %d;"
+				       " handler not registered!\n", count);

arch/tile/kernel/hv_drivers.c

Quoted 10 lines
arch/tile/kernel/hv_drivers.c new file +10 -0
+			} else {
+				desc->handler(desc->dev_id);
+			}
+
+			/* Count device irqs; IPIs are counted elsewhere. */
+			if (count > HV_MAX_IPI_INTERRUPT)
+				__get_cpu_var(irq_stat).irq_dev_intr_count++;
+		}
+		pending_dev_intr_mask >>= 1;
+	}

Why the extra indirection for regular interrupts instead of always calling generic_handle_irq?

arch/tile/kernel/memprof.c

Quoted 5 lines
arch/tile/kernel/memprof.c new file +0 -0
new file mode 100644
index 0000000..9424cc5

I suppose this could get dropped in favor of perf events?

arch/tile/kernel/memprof.c

Quoted 11 lines
arch/tile/kernel/memprof.c new file +11 -0
+/*
+ * These came from asm-tile/io.h, they made the compiler assert when
+ * they were inlined there, but I shouldn't be worried about the
+ * overhead of the function call if they're just calling panic.
+ */
+
+u32 inb(u32 addr)
+{
+	panic("inb not implemented");
+}
+EXPORT_SYMBOL(inb);

If you just remove these definitions, you get a link error for any driver that tries to use these, which is probably more helpful than the panic.

OTOH, are you sure that you can't just map the PIO calls to mmio functions like readb plus some fixed offset? On most non-x86 architectures, the PIO area of the PCI bus is just mapped to a memory range somewhere.

Quoted 9 lines

+/****************************************************************
+ *
+ * Backward compatible /proc/pci interface.
+ * This is borrowed from 2.6.9, it was dropped by 2.6.18.
+ *
+ * It's good for debugging, in the absence of lspci, but is not
+ * needed for anything to work.
+ *
+ ****************************************************************/

Does this do anything that you can't do with lspci/setpci? I'd suggest just dropping this again.

Quoted 3 lines

+/*
+ * Support /proc/PID/pgtable
+ */

Do you have applications relying on this? While I can see how this may be useful, I don't think we should have a generic interface like this in architecture specific code.

It also may be used as an attack vector for malicious applications that have a way of accessing parts of physical memory.

I think it would be better to drop this interface for now.

arch/tile/kernel/memprof.c

Quoted 6 lines
arch/tile/kernel/memprof.c new file +6 -0
+/* Simple /proc/tile files. */
+SIMPLE_PROC_ENTRY(grid, "%u\t%u\n", smp_width, smp_height)
+
+/* More complex /proc/tile files. */
+static void proc_tile_seq_strconf(struct seq_file *sf, char* what,
+	uint32_t query)

All of these look like they should be files in various places in sysfs, e.g. in /sys/devices/system/cpu or /sys/firmware/. Procfs is not necessarily evil, but most of your uses are for stuff that actually first very well into what we have in sysfs.

Quoted 22 lines
arch/tile/kernel/memprof.c new file +22 -0
+SEQ_PROC_ENTRY(memory)
+static int proc_tile_memory_show(struct seq_file *sf, void *v)
+{
+	int node;
+	int ctrl;
+	HV_Coord coord = { 0, 0 };
+	/*
+	 * We make two passes here; one through our memnodes to display
+	 * which controllers they correspond with, and one through all
+	 * controllers to get their speeds.  We may not actually have
+	 * access to all of the controllers whose speeds we retrieve, but
+	 * we get them because they're useful for mcstat, which provides
+	 * stats for physical controllers whether we're using them or not.
+	 */
+	for (node = 0; node < MAX_NUMNODES; node++) {
+		ctrl = node_controller[node];
+		if (ctrl >= 0)
+			seq_printf(sf, "controller_%d_node: %d\n", ctrl, node);
+	}
+	/*
+	 * Note that we use MAX_NUMNODES as the limit for the controller
+	 * loop because we don't have anything better.

arch/tile/kernel/memprof.c

Quoted 10 lines
arch/tile/kernel/memprof.c new file +10 -0
+	 */
+	for (ctrl = 0; ctrl < MAX_NUMNODES; ctrl++) {
+		HV_MemoryControllerInfo info =
+			hv_inquire_memory_controller(coord, ctrl);
+		if (info.speed)
+			seq_printf(sf, "controller_%d_speed: %llu\n",
+				   ctrl, info.speed);
+	}
+	return 0;
+}

This one should probably be split up into files under /sys/devices/system/node/nodeX/

Quoted 10 lines
arch/tile/kernel/memprof.c new file +10 -0
+#ifdef CONFIG_DATAPLANE
+SEQ_PROC_ENTRY(dataplane)
+static int proc_tile_dataplane_show(struct seq_file *sf, void *v)
+{
+	int cpu;
+	int space = 0;
+	for_each_cpu(cpu, &dataplane_map) {
+		if (space)
+			seq_printf(sf, " ");
+		else

arch/tile/kernel/memprof.c

Quoted 10 lines
arch/tile/kernel/memprof.c new file +10 -0
+			space = 1;
+		seq_printf(sf, "%d", cpu);
+	}
+	if (space)
+		seq_printf(sf, "\n");
+	return 0;
+}
+#else
+#define proc_tile_dataplane_init() do {} while (0)
+#endif

Not sure where in sysfs this would fit best, but I think the format should match that of the other cpu bitmaps in /sys/devices/system/node.

Quoted 12 lines
arch/tile/kernel/memprof.c new file +12 -0
+SEQ_PROC_ENTRY(interrupts)
+static int proc_tile_interrupts_show(struct seq_file *sf, void *v)
+{
+	int i;
+
+	seq_printf(sf, "%-8s%8s%8s%8s%8s%8s%8s%8s\n", "",
+		   "timer", "syscall", "resched", "hvflush", "SMPcall",
+		   "hvmsg", "devintr");
+
+	for_each_online_cpu(i) {
+		irq_cpustat_t *irq = &per_cpu(irq_stat, i);
+		seq_printf(sf, "%-8d%8d%8d%8d%8d%8d%8d%8d\n", i,

arch/tile/kernel/memprof.c

Quoted 10 lines
arch/tile/kernel/memprof.c new file +10 -0
+			   irq->irq_timer_count,
+			   irq->irq_syscall_count,
+			   irq->irq_resched_count,
+			   irq->irq_hv_flush_count,
+			   irq->irq_call_count,
+			   irq->irq_hv_msg_count,
+			   irq->irq_dev_intr_count);
+	}
+	return 0;
+}

Can you merge this with /proc/interrupts?

arch/tile/kernel/memprof.c

Quoted 8 lines
arch/tile/kernel/memprof.c new file +8 -0
+#ifdef CONFIG_FEEDBACK_COLLECT
+
+extern void *__feedback_edges_ptr;
+extern long __feedback_edges_size;
+extern void flush_my_deferred_graph(void *dummy);
+
+ssize_t feedback_read(struct file *file, char __user *buf, size_t size,
+		      loff_t *ppos)

This probably belongs into debugfs, similar to what we do for gcov.

How much of the feedbackl stuff is generic? It might be good to put those bits in a common place like kernel/feedback.c so that other architectures can implement this as well.

Quoted 28 lines
arch/tile/kernel/memprof.c new file +28 -0
+/*
+ * Support /proc/sys/tile directory
+ */
+
+
+static ctl_table unaligned_table[] = {
+	{
+		.procname	= "enabled",
+		.data		= &unaligned_fixup,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec
+	},
+	{
+		.procname	= "printk",
+		.data		= &unaligned_printk,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec
+	},
+	{
+		.procname	= "count",
+		.data		= &unaligned_fixup_count,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec
+	},
+	{}

arch/tile/kernel/memprof.c

Quoted 10 lines
arch/tile/kernel/memprof.c new file +10 -0
+};
+
+
+static ctl_table tile_root[] = {
+
+	{
+		.procname	= "unaligned_fixup",
+		.mode		= 0555,
+		unaligned_table
+	},

Hmm, similar to what sh64 does, yet different.
Not much of a problem though.

arch/tile/kernel/memprof.c

Quoted 9 lines
arch/tile/kernel/memprof.c new file +9 -0
+	{
+		.procname	= "crashinfo",
+		.data		= &show_crashinfo,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec
+	},
+	{}
+};

How is this different from the existing exception-trace/userprocess_debug sysctl?
If it is very similar, let's not introduce yet another name for it but just use the common userprocess_debug.

arch/tile/kernel/memprof.c

Quoted 13 lines
arch/tile/kernel/memprof.c new file +13 -0
+
+#if CHIP_HAS_CBOX_HOME_MAP()
+static ctl_table hash_default_table[] = {
+	{
+		.procname	= "hash_default",
+		.data		= &hash_default,
+		.maxlen		= sizeof(int),
+		.mode		= 0444,
+		.proc_handler	= &proc_dointvec
+	},
+	{}
+};
+#endif

This seems to be read-only and coming from a kernel command line option, so I guess looking at /proc/cmdline would be a reasonable alternative.

Quoted 13 lines
arch/tile/kernel/memprof.c new file +13 -0
+long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+{
+	unsigned long __user *datap;
+	unsigned long tmp;
+	int i;
+	long ret = -EIO;
+
+#ifdef CONFIG_COMPAT
+	if (task_thread_info(current)->status & TS_COMPAT)
+		data = (u32)data;
+	if (task_thread_info(child)->status & TS_COMPAT)
+		addr = (u32)addr;
+#endif

arch/tile/kernel/memprof.c

Quoted 10 lines
arch/tile/kernel/memprof.c new file +10 -0
+	datap = (unsigned long __user *)data;
+
+	switch (request) {
+
+	case PTRACE_PEEKUSR:  /* Read register from pt_regs. */
+	case PTRACE_POKEUSR:  /* Write register in pt_regs. */
+	case PTRACE_GETREGS:  /* Get all registers from the child. */
+	case PTRACE_SETREGS:  /* Set all registers in the child. */
+	case PTRACE_GETFPREGS:  /* Get the child FPU state. */
+	case PTRACE_SETFPREGS:  /* Set the child FPU state. */

I believe the new way to do this is to implement CONFIG_HAVE_ARCH_TRACEHOOK and get all these for free.

arch/tile/kernel/memprof.c

Quoted 9 lines
arch/tile/kernel/memprof.c new file +9 -0
+	case PTRACE_SETOPTIONS:
+		/* Support TILE-specific ptrace options. */
+		child->ptrace &= ~PT_TRACE_MASK_TILE;
+		tmp = data & PTRACE_O_MASK_TILE;
+		data &= ~PTRACE_O_MASK_TILE;
+		ret = ptrace_request(child, request, addr, data);
+		if (tmp & PTRACE_O_TRACEMIGRATE)
+			child->ptrace |= PT_TRACE_MIGRATE;
+		break;

It may be better to add this to the common code, possibly in an #ifdef CONFIG_ARCH_TILE, to make sure we never get conflicting numbers for future PTRACE_O_* values.

arch/tile/kernel/memprof.c

Quoted 2 lines
arch/tile/kernel/memprof.c new file +2 -0
+SYSCALL_DEFINE3(raise_fpe, int, code, unsigned long, addr,
+		struct pt_regs *, regs)

Does this need to be a system call? I thought we already had other architectures without floating point exceptions in hardware that don't need this.

Quoted 18 lines
arch/tile/kernel/stack.c new file +13 -0
new file mode 100644
index 0000000..3190bc1
+/* Callback for backtracer; basically a glorified memcpy */
+static bool read_memory_func(void *result, VirtualAddress address,
+			     unsigned int size, void *vkbt)
+{
+	int retval;
+	struct KBacktraceIterator *kbt = (struct KBacktraceIterator *)vkbt;
+	if (in_kernel_text(address)) {
+		/* OK to read kernel code. */
+	} else if (address >= PAGE_OFFSET) {
+		/* We only tolerate kernel-space reads of this task's stack */
+		if (!in_kernel_stack(kbt, address))
+			return 0;
+	} else if (kbt->pgtable == NULL) {

arch/tile/kernel/stack.c

Quoted 10 lines
arch/tile/kernel/stack.c new file +10 -0
+		return 0;	/* can't read user space in other tasks */
+	} else if (!valid_address(kbt, address)) {
+		return 0;	/* invalid user-space address */
+	}
+	pagefault_disable();
+	retval = __copy_from_user_inatomic(result, (const void *)address,
+					   size);
+	pagefault_enable();
+	return (retval == 0);
+}

more backtrace code in stack.c, same comment as above.

Quoted 24 lines
arch/tile/kernel/sys.c new file +19 -0
new file mode 100644
index 0000000..97fde79
+/*
+ * Syscalls that pass 64-bit values on 32-bit systems normally
+ * pass them as (low,high) word packed into the immediately adjacent
+ * registers.  If the low word naturally falls on an even register,
+ * our ABI makes it work correctly; if not, we adjust it here.
+ * Handling it here means we don't have to fix uclibc AND glibc AND
+ * any other standard libcs we want to support.
+ */
+
+
+
+ssize_t sys32_readahead(int fd, u32 offset_lo, u32 offset_hi, u32 count)
+{
+	return sys_readahead(fd, ((loff_t)offset_hi << 32) | offset_lo, count);
+}
+
+long sys32_fadvise64(int fd, u32 offset_lo, u32 offset_hi,
+		     u32 len, int advice)
+{

arch/tile/kernel/sys.c

Quoted 10 lines
arch/tile/kernel/sys.c new file +10 -0
+	return sys_fadvise64_64(fd, ((loff_t)offset_hi << 32) | offset_lo,
+				len, advice);
+}
+
+int sys32_fadvise64_64(int fd, u32 offset_lo, u32 offset_hi,
+		       u32 len_lo, u32 len_hi, int advice)
+{
+	return sys_fadvise64_64(fd, ((loff_t)offset_hi << 32) | offset_lo,
+				((loff_t)len_hi << 32) | len_lo, advice);
+}

These seem to belong with the other similar functions in compat.c

Quoted 21 lines
arch/tile/kernel/sys.c new file +21 -0
+
+
+
+/*
+ * This API uses a 4KB-page-count offset into the file descriptor.
+ * It is likely not the right API to use on a 64-bit platform.
+ */
+SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
+	       unsigned long, prot, unsigned long, flags,
+	       unsigned int, fd, unsigned long, off_4k)
+{
+#define PAGE_ADJUST (PAGE_SHIFT - 12)
+	if (off_4k & ((1 << PAGE_ADJUST) - 1))
+		return -EINVAL;
+	return sys_mmap_pgoff(addr, len, prot, flags, fd,
+			      off_4k >> PAGE_ADJUST);
+}
+
+/*
+ * This API uses a byte offset into the file descriptor.
+ * It is likely not the right API to use on a 32-bit platform.

arch/tile/kernel/sys.c

Quoted 10 lines
arch/tile/kernel/sys.c new file +10 -0
+ */
+SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
+	      unsigned long, prot, unsigned long, flags,
+	      unsigned int, fd, unsigned long, offset)
+{
+	if (offset & ((1 << PAGE_SHIFT) - 1))
+		return -EINVAL;
+	return sys_mmap_pgoff(addr, len, prot, flags, fd,
+			      offset >> PAGE_SHIFT);
+}

Just use the sys_mmap_pgoff system call directly, rather than defining your own wrappers. Since that syscall is newer than asm-generic/unistd.h, that file might need some changes, together with fixes to arch/score to make sure we don't break its ABI.

arch/tile/kernel/syscall_table.S

Quoted 5 lines
arch/tile/kernel/syscall_table.S new file +0 -0
new file mode 100644
index 0000000..7fcd160

This file should be replaced with the C variant, as arch/score/kernel/sys_call_table.c does.

Quoted 17 lines
arch/tile/kernel/tile-desc_32.c new file +11 -0
new file mode 100644
index 0000000..771eab1
@@ -0,0 +1,13865 @@
+/* Define to include "bfd.h" and get actual BFD relocations below. */
+/* #define WANT_BFD_RELOCS */
+
+#ifdef WANT_BFD_RELOCS
+#include "bfd.h"
+#define MAYBE_BFD_RELOC(X) (X)
+#else
+#define MAYBE_BFD_RELOC(X) -1
+#endif
+
+/* Special registers. */

arch/tile/kernel/tile-desc_32.c line 21

Quoted 10 lines
arch/tile/kernel/tile-desc_32.c new file +10 -0
+#define TREG_LR 55
+#define TREG_SN 56
+#define TREG_ZERO 63
+
+#if defined(__KERNEL__) || defined(_LIBC)
+// FIXME: Rename this.
+#include <asm/opcode-tile.h>
+#else
+#include "tile-desc.h"
+#endif

It seems that this file fits in the same category as the backtrace code. Maybe move both away from arch/tile/kernel into a different directory?

arch/tile/lib/checksum.c

Quoted 5 lines
arch/tile/lib/checksum.c new file +0 -0
new file mode 100644
index 0000000..a909a35

Have you tried to use the generic lib/checksum.c implementation?

Arnd

#23 lore raw
Quoted 4 lines · Arnd Bergmann

Here comes the rest of my review, covering the arch/tile/kernel/ directory. There isn't much to comment on in arch/tile/mm and arch/tile/lib from my side, and I still ignored the drivers and oprofile directories.

Thanks, that's great. The drivers and oprofile stuff will not be part of the submission we will make this week anyway, so I think that's OK.

Quoted 10 lines

arch/tile/kernel/backtrace.c

Quoted 2 lines
arch/tile/kernel/backtrace.c +0 -0
[...]

this
file looks rather complicated compared to what the other architectures do.

Is this really necessary because of some property of the architecture or do you implement other functionality that is not present on existing archs?

The functionality we implement is to support backtrace of arbitrary code, as long as it follows a pretty minimalist ABI. This includes pretty much arbitrarily-optimized code, as well as, of course, code with no dwarf debug info available. As a result the backtracer is slightly more complicated, but only for the initial leaf function; after that it's easy to chain through the call frames.

Quoted 4 lines

Yes, that makes sense. You definitely want binary compatibility between 32 bit binaries from a native 32 bit system on TILE-Gx in the syscall interface.

The thing is, the COMPAT layer on TILE-Gx is actually not providing TILEPro compatibility, since the architectures are too different -- conceptually similar but with different opcode numbering, etc. Instead what it's doing is providing a 32-bit pointer ABI, to help porting crufty old code (this is in fact the primary customer driver), or to allow more compact representations of pointer-heavy data.

Quoted 4 lines

compat_sys_sendfile will not be needed with the asm-generic/unistd.h definitions, but I think you will still need a compat_sys_sendfile64, to which the same applies as to compat_sys_sched_rr_get_interval.

I think it's the other way around: compat_sys_sendfile64() is just sys_sendfile64(), but compat_sys_sendfile() needs to exist since it has to write a 32-bit pointer back to userspace.

Quoted 8 lines

arch/tile/kernel/backtrace.c

Quoted 5 lines
arch/tile/kernel/backtrace.c +3 -0
+static int hardwall_ioctl(struct inode *inode, struct file *file,
+			  unsigned int a, unsigned long b)
+{
[...]

The hardwall stuff looks like it is quite central to your architecture. Could you elaborate on what it does?

It's not "central" but it is an important enabler for access to our "user network". This is a wormhole-routed mesh network (the UDN, or user dynamic network) that connects all the cpus. If a task affinitizes itself to a single cpu (to avoid migration) and opens /dev/hardwall and does an ioctl on it, it can associate the particular /dev/hardwall file object with some non-overlapping subrectangle of the whole 8x8 chip (our cpus are laid out as "tiles" in an 8x8 configuration). It can then do an "activate" ioctl to get access to that subrectangle of the UDN, from that cpu. Other threads in that process (or anyone who can share that file object one way or another, e.g. fork or sendmsg) can then also do an "activate" ioctl on that file object and also get access, and they can then exchange messages with very low latency (register file to register file in a handful of cycles) and high bandwidth (32 bits/cycle or about 3GB/sec).

The actual "hardwall" refers to the fact that cpus on the periphery of the allocated subrectangle of cpus set up the router so that they will get an interrupt if some cpu tries to send a message that would terminate outside the set of allocated cpus. Doing it this way means several unrelated tasks could have separate message-passing arenas (spatially dividing the chip) and whenever the last task holding a reference to a hardwall file object exits, the OS can drain any messages from the UDN and deallocate the subrectangle in question.

Quoted 3 lines

If it is as essential as it looks, I'd vote for promoting the interface from an ioctl based one to four real system calls (more if necessary).

The notion of using a file descriptor as the "rights" object is pretty central, so I think a character device will work out well.

Quoted 5 lines

Note that the procfs file format is part of your ABI, and this looks relatively hard to parse, which may introduce bugs.
For per-process information, it would be better to have a simpler file in each /proc/<pid>/directory. Would that work for you?

Well, the hardwalls aren't exactly per-process anyway, and we don't in practice use the ASCII output for anything much, so it may not matter that they're not too parseable. I may just look into making them more parsable when I convert it to a /dev interface and leave it at that.

I'm planning to defer this in any case, since the UDN interface, though a nice-to-have, obviously isn't needed to run any standard C code. I'll make that part of a follow-up patch.

Quoted 3 lines

Note that we're about to remove the .ioctl file operation and replace it with .unlocked_ioctl everywhere.

OK, for now I'll ensure that we are locking everything internally correctly. I believe we are already anyway.

Quoted 4 lines

[hugevmap] Not used anywhere apparently. Can you explain what this is good for? Maybe leave it out for now, until you merge the code that needs it. I don't see anything obviously wrong with the implementation though.

I'll omit it; we haven't used it yet. The intent was to provide guaranteed huge pages for TLB purposes to kernel drivers. Currently we just start with huge pages where possible, and fragment them if necessary.

Quoted 6 lines
Quoted 2 lines

+++ b/arch/tile/kernel/hv_drivers.c

Please have a look at drivers/char/hvc_{rtas,beat,vio,iseries}.c to see how we do the same for other hypervisors, in a much simpler way.

Great, thanks for the pointer.

Quoted 8 lines

arch/tile/kernel/memprof.c

Quoted 6 lines
arch/tile/kernel/memprof.c new file +0 -0
new file mode 100644
index 0000000..9424cc5

I suppose this could get dropped in favor of perf events?

I don't know enough about perf events to be sure, but I don't think so; the memprof device is intended to provide a stream of information on things like memory latency and bandwidth. But perhaps it could be wired into perf events. I'll probably move this to "drivers", and in any case omit it entirely from the first patch.

Quoted 10 lines

+EXPORT_SYMBOL(inb);

If you just remove these definitions, you get a link error for any driver that tries to use these, which is probably more helpful than the panic.

OTOH, are you sure that you can't just map the PIO calls to mmio functions like readb plus some fixed offset? On most non-x86 architectures, the PIO area of the PCI bus is just mapped to a memory range somewhere.

I'll try to remove them and see if anything falls over. We don't have any memory-mapped addresses in the 32-bit architecture, though that changes with the 64-bit architecture, which introduces IO mappings. For PCI we actually have to do a hypervisor transaction for reads or writes.

Quoted 9 lines
Quoted 4 lines

+/*
+ * Support /proc/PID/pgtable
+ */

Do you have applications relying on this? While I can see how this may be useful, I don't think we should have a generic interface like this in architecture specific code.

Quoted 5 lines

It also may be used as an attack vector for malicious applications that have a way of accessing parts of physical memory.

I think it would be better to drop this interface for now.

We do find it useful internally, mostly because it shows you what homecaching is actually in effect for pages in an application. But we don't rely on it, and it is (to be generous) only semi-tastefully hooked into the generic code, and the hooks are not present in the code we're currently trying to return to the community. So I'll remove it for now.

Quoted 12 lines

arch/tile/kernel/memprof.c

Quoted 7 lines
arch/tile/kernel/memprof.c new file +6 -0
+/* Simple /proc/tile files. */
+SIMPLE_PROC_ENTRY(grid, "%u\t%u\n", smp_width, smp_height)
+
+/* More complex /proc/tile files. */
+static void proc_tile_seq_strconf(struct seq_file *sf, char* what,
+	uint32_t query)

All of these look like they should be files in various places in sysfs, e.g. in /sys/devices/system/cpu or /sys/firmware/. Procfs is not necessarily evil, but most of your uses are for stuff that actually first very well into what we have in sysfs.

Interesting possibility. I'll look into it.

Quoted 7 lines

arch/tile/kernel/memprof.c

Quoted 5 lines
arch/tile/kernel/memprof.c new file +3 -0
+SEQ_PROC_ENTRY(interrupts)
+static int proc_tile_interrupts_show(struct seq_file *sf, void *v)
+{
[...]

Can you merge this with /proc/interrupts?

It turns out /proc/interrupts is formatted the wrong way round if you have 64 processors :-) You want one row per cpu, not one column per cpu!

Also, there are things listed that are not strictly IRQs in the normal sense (things like TLB flushes and syscalls) which are still good for assessing where latency glitches might be coming from on a particular cpu.

In any case, this will likely be removed for the first round of submission, along with all the other /proc stuff.

Quoted 9 lines
Quoted 2 lines

+#ifdef CONFIG_FEEDBACK_COLLECT
+[...]

This probably belongs into debugfs, similar to what we do for gcov.

How much of the feedbackl stuff is generic? It might be good to put those bits in a common place like kernel/feedback.c so that other architectures can implement this as well.

Hmm, interesting. The feedback stuff is somewhat generic, at least the link-ordering piece; it relies on some separate userspace code that computes cache-conflict information and then lays out all the functions in a good order based on who calls whom. But I'll be removing it for now and then re-introducing it later as a separate patch anyway.

Quoted 5 lines
Quoted 5 lines
arch/tile/kernel/memprof.c new file +5 -0
+		.procname	= "crashinfo",
+		.data		= &show_crashinfo,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec
Quoted 9 lines

arch/tile/kernel/memprof.c

Quoted 4 lines
arch/tile/kernel/memprof.c new file +3 -0
+	},
+	{}
+};

How is this different from the existing exception-trace/userprocess_debug sysctl?
If it is very similar, let's not introduce yet another name for it but just use the common userprocess_debug.

I had made a note of doing this earlier when I was porting our code up to 2.6.34. For now I'm going to remove the tile-specific thing, and then later look at using the exception-trace hook. I think they're pretty similar.

Quoted 4 lines

This seems to be read-only and coming from a kernel command line option, so I guess looking at /proc/cmdline would be a reasonable alternative.

I always find that kind of painful, since you have to parse it exactly as the kernel would to be sure you're getting it right; strstr() is only a 99% solution.

Quoted 3 lines

I believe the new way to do this is to implement CONFIG_HAVE_ARCH_TRACEHOOK and get all these for free.

I'll check that out.

Quoted 7 lines

arch/tile/kernel/memprof.c

Quoted 3 lines
arch/tile/kernel/memprof.c new file +2 -0
+SYSCALL_DEFINE3(raise_fpe, int, code, unsigned long, addr,
+		struct pt_regs *, regs)

Does this need to be a system call? I thought we already had other architectures without floating point exceptions in hardware that don't need this.

Hmm, I didn't know about that. Any information would be appreciated. I guess you could synthesize something that looked like a signal purely in user-space? But how would debuggers trap it? I'm not sure how it would work without a system call.

Quoted 11 lines

arch/tile/kernel/sys.c

Quoted 9 lines
arch/tile/kernel/sys.c +5 -0
[...]
+ssize_t sys32_readahead(int fd, u32 offset_lo, u32 offset_hi, u32 count)
+{
+	return sys_readahead(fd, ((loff_t)offset_hi << 32) | offset_lo, count);
+}
+

These seem to belong with the other similar functions in compat.c

Except they're also used by the 32-bit platform where there is no compat mode (the compat code DOES use them too, it's true).

Quoted 6 lines

Just use the sys_mmap_pgoff system call directly, rather than defining your own wrappers. Since that syscall is newer than asm-generic/unistd.h, that file might need some changes, together with fixes to arch/score to make sure we don't break its ABI.

It should be OK. Their sys_mmap2() just tail-calls sys_mmap_pgoff() anyway, so it should be possible to switch mmap2 in asm-generic/unistd.h to be mmap_pgoff instead. We'll need some user-space changes (our mmap2 is defined in 4KB units) but that's not hard.

Quoted 4 lines

It seems that this file fits in the same category as the backtrace code. Maybe move both away from arch/tile/kernel into a different directory?

I'll think about it. These are both basically disassembly-related, so maybe an arch/tile/disasm directory with the tile_desc stuff and the backtracer? I'm not sure it's really worth moving out of arch/tile/kernel though.

Quoted 1 line

Have you tried to use the generic lib/checksum.c implementation?

That sounds good. We only touched do_csum(), which already has an "#ifndef do_csum" in the generic code.

Thanks for all this!

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
maintainer
#24 lore raw
Quoted 11 lines · Chris Metcalf
Quoted 4 lines

Yes, that makes sense. You definitely want binary compatibility between 32 bit binaries from a native 32 bit system on TILE-Gx in the syscall interface.

The thing is, the COMPAT layer on TILE-Gx is actually not providing TILEPro compatibility, since the architectures are too different -- conceptually similar but with different opcode numbering, etc. Instead what it's doing is providing a 32-bit pointer ABI, to help porting crufty old code (this is in fact the primary customer driver), or to allow more compact representations of pointer-heavy data.

Ah, interesting. I don't think any architecture does it this way so far. IIRC, while alpha had some applications built in 32 bit mode in the early days, those were just using the 64 bit system calls directly.

Then again, that probably required some rather ugly hacks to get the libc working, so since we have the compat code in kernel now, your approach is probably much better.

Are you able to build 32 bit kernels for TILE-Gx as well? It's probably something you never really want to do for performance reasons, but I guess you could use that to verify that the ABI is really compatible.

Quoted 8 lines
Quoted 4 lines

compat_sys_sendfile will not be needed with the asm-generic/unistd.h definitions, but I think you will still need a compat_sys_sendfile64, to which the same applies as to compat_sys_sched_rr_get_interval.

I think it's the other way around: compat_sys_sendfile64() is just sys_sendfile64(), but compat_sys_sendfile() needs to exist since it has to write a 32-bit pointer back to userspace.

Ah. I guess you're right about compat_sys_sendfile64 not being needed. Funny enough, parisc, powerpc, s390 and sparc all define it anyway, so it didn't occur to me that they don't actually need to.

What I meant about compat_sys_sendfile is that you only define it if the 32 bit ABI contains a reference to sys_sendfile in the first place. With asm-generic/unistd.h, 32 bit uses always uses the sys_sendfile64 kernel interface, while for 64 bit the two are identical, so we take the regular sys_sendfile.

Quoted 32 lines
Quoted 8 lines

Review

Quoted 5 lines
(quoted diff) +3 -0
+static int hardwall_ioctl(struct inode *inode, struct file *file,
+                      unsigned int a, unsigned long b)
+{
[...]

The hardwall stuff looks like it is quite central to your architecture. Could you elaborate on what it does?

It's not "central" but it is an important enabler for access to our "user network". This is a wormhole-routed mesh network (the UDN, or user dynamic network) that connects all the cpus. If a task affinitizes itself to a single cpu (to avoid migration) and opens /dev/hardwall and does an ioctl on it, it can associate the particular /dev/hardwall file object with some non-overlapping subrectangle of the whole 8x8 chip (our cpus are laid out as "tiles" in an 8x8 configuration). It can then do an "activate" ioctl to get access to that subrectangle of the UDN, from that cpu. Other threads in that process (or anyone who can share that file object one way or another, e.g. fork or sendmsg) can then also do an "activate" ioctl on that file object and also get access, and they can then exchange messages with very low latency (register file to register file in a handful of cycles) and high bandwidth (32 bits/cycle or about 3GB/sec).

The actual "hardwall" refers to the fact that cpus on the periphery of the allocated subrectangle of cpus set up the router so that they will get an interrupt if some cpu tries to send a message that would terminate outside the set of allocated cpus. Doing it this way means several unrelated tasks could have separate message-passing arenas (spatially dividing the chip) and whenever the last task holding a reference to a hardwall file object exits, the OS can drain any messages from the UDN and deallocate the subrectangle in question.

Quoted 6 lines
Quoted 3 lines

If it is as essential as it looks, I'd vote for promoting the interface from an ioctl based one to four real system calls (more if necessary).

The notion of using a file descriptor as the "rights" object is pretty central, so I think a character device will work out well.

ok, I see. Now you could easily do this with system calls as well:
Instead of the initial ioctl that associates the file descriptor with a rectangle, you can have a syscall that creates a rectangle and a file descriptor (using anon_inode_getfd) associated with it, and returns the fd to user space. This is similar to what we do for other system call interfaces that operate on their own fds.

Another alternative might be to combine this with cpusets subsystem, which has a related functionality. I guess that would be the preferred way if you expect tile-gx to take over the world and have lots of applications written to it.
For a niche product, the syscall or ioctl approach does seem simple enough, and it does not require other users of cpusets to learn about requirements of your rectangles.

Quoted 10 lines
Quoted 5 lines

Note that the procfs file format is part of your ABI, and this looks relatively hard to parse, which may introduce bugs.
For per-process information, it would be better to have a simpler file in each /proc/<pid>/directory. Would that work for you?

Well, the hardwalls aren't exactly per-process anyway, and we don't in practice use the ASCII output for anything much, so it may not matter that they're not too parseable. I may just look into making them more parsable when I convert it to a /dev interface and leave it at that.

On a chardev, a binary interface seems more appropriate than an text based one anyway, so you could add another ioctl for this.

Quoted 3 lines

I'm planning to defer this in any case, since the UDN interface, though a nice-to-have, obviously isn't needed to run any standard C code. I'll make that part of a follow-up patch.

ok

Quoted 6 lines
Quoted 3 lines

Note that we're about to remove the .ioctl file operation and replace it with .unlocked_ioctl everywhere.

OK, for now I'll ensure that we are locking everything internally correctly. I believe we are already anyway.

ok. Then please just use .unlocked_ioctl in new drivers.

Quoted 8 lines
Quoted 4 lines

[hugevmap] Not used anywhere apparently. Can you explain what this is good for? Maybe leave it out for now, until you merge the code that needs it. I don't see anything obviously wrong with the implementation though.

I'll omit it; we haven't used it yet. The intent was to provide guaranteed huge pages for TLB purposes to kernel drivers. Currently we just start with huge pages where possible, and fragment them if necessary.

Ok. Do you use huge pages for backing the linear kernel mapping? Normally device drivers get huge pages for free in kmalloc and get_free_pages because all the memory is mapped using the largest page size anyway.

Quoted 11 lines
Quoted 10 lines

+EXPORT_SYMBOL(inb);

If you just remove these definitions, you get a link error for any driver that tries to use these, which is probably more helpful than the panic.

OTOH, are you sure that you can't just map the PIO calls to mmio functions like readb plus some fixed offset? On most non-x86 architectures, the PIO area of the PCI bus is just mapped to a memory range somewhere.

Quoted 4 lines

I'll try to remove them and see if anything falls over. We don't have any memory-mapped addresses in the 32-bit architecture, though that changes with the 64-bit architecture, which introduces IO mappings. For PCI we actually have to do a hypervisor transaction for reads or writes.

Ok, then I assume that PIO would also be a hypervisor call, right? If you don't have MMIO on 32 bit, you might want to not define either PIO (inb, ...) no MMIO (readb, ...) calls there and disable CONFIG_HAVE_MMIO in Kconfig.

Quoted 10 lines
Quoted 7 lines

Review

Quoted 5 lines
(quoted diff) +3 -0
+SEQ_PROC_ENTRY(interrupts)
+static int proc_tile_interrupts_show(struct seq_file *sf, void *v)
+{
[...]

Can you merge this with /proc/interrupts?

It turns out /proc/interrupts is formatted the wrong way round if you have 64 processors :-) You want one row per cpu, not one column per cpu!

Yes, interesting observation. I'm sure the Altix folks are suffering from this a lot.

Quoted 3 lines

Also, there are things listed that are not strictly IRQs in the normal sense (things like TLB flushes and syscalls) which are still good for assessing where latency glitches might be coming from on a particular cpu.

That's fine, just look at what a current x86 kernel gives you (slightly cut):
CPU0 CPU1

  0:   18764948     504980   IO-APIC-edge      timer
  1:     228456       2572   IO-APIC-edge      i8042
  9:    2632595      79544   IO-APIC-fasteoi   acpi
 12:    1094468      43409   IO-APIC-edge      i8042
 16:      82761       1455   IO-APIC-fasteoi   uhci_hcd:usb6, yenta, heci
 28:     908865      85857   PCI-MSI-edge      ahci
 29:       6421      11595   PCI-MSI-edge      eth0
NMI:          0          0   Non-maskable interrupts
LOC:    1987682    9057144   Local timer interrupts
SPU:          0          0   Spurious interrupts
CNT:          0          0   Performance counter interrupts
PND:          0          0   Performance pending work
RES:    3598785    3903513   Rescheduling interrupts
CAL:       8848       5944   Function call interrupts
TLB:      31467      18283   TLB shootdowns
TRM:          0          0   Thermal event interrupts
THR:          0          0   Threshold APIC interrupts
MCE:          0          0   Machine check exceptions
MCP:        354        346   Machine check polls
ERR:          0
MIS:          0

Lots of things in there that fit your category.

Quoted 8 lines
Quoted 4 lines

This seems to be read-only and coming from a kernel command line option, so I guess looking at /proc/cmdline would be a reasonable alternative.

I always find that kind of painful, since you have to parse it exactly as the kernel would to be sure you're getting it right; strstr() is only a 99% solution.

How about making it a module_param then? You can still see it in /sys/modules/*/parameters then, even if the code is builtin, but it won't be in the sysctl name space any more.

Quoted 8 lines
Quoted 7 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+SYSCALL_DEFINE3(raise_fpe, int, code, unsigned long, addr,
+            struct pt_regs *, regs)

Does this need to be a system call? I thought we already had other architectures without floating point exceptions in hardware that don't need this.

Quoted 4 lines

Hmm, I didn't know about that. Any information would be appreciated. I guess you could synthesize something that looked like a signal purely in user-space? But how would debuggers trap it? I'm not sure how it would work without a system call.

I think the C99 standard allows you to not implement SIGFPE at all but instead rely on applications doing fetestexcept() etc.

Quoted 12 lines
Quoted 11 lines

arch/tile/kernel/sys.c

Quoted 9 lines
arch/tile/kernel/sys.c +5 -0
[...]
+ssize_t sys32_readahead(int fd, u32 offset_lo, u32 offset_hi, u32 count)
+{
+    return sys_readahead(fd, ((loff_t)offset_hi << 32) | offset_lo, count);
+}
+

These seem to belong with the other similar functions in compat.c

Quoted 2 lines

Except they're also used by the 32-bit platform where there is no compat mode (the compat code DOES use them too, it's true).

I see. AFAICT, all other architectures don't need the wrapper in the 32 bit native case because they define the syscall calling conventions in libc such that they match what the kernel expects for a 64 bit argument (typically split in two subsequent argument slots). Would that work for you as well?

Quoted 11 lines
Quoted 6 lines

Just use the sys_mmap_pgoff system call directly, rather than defining your own wrappers. Since that syscall is newer than asm-generic/unistd.h, that file might need some changes, together with fixes to arch/score to make sure we don't break its ABI.

It should be OK. Their sys_mmap2() just tail-calls sys_mmap_pgoff() anyway, so it should be possible to switch mmap2 in asm-generic/unistd.h to be mmap_pgoff instead. We'll need some user-space changes (our mmap2 is defined in 4KB units) but that's not hard.

Hmm, I forgot about the page size. Actually the definition of sys_mmap2 is to use 4KB units on all architectures except ia64, independent of the real page size. Maybe it's better to keep using sys_mmap/sys_mmap2 after all but then use only one of the two (sys_mmap on 64 bit, sys_mmap2 on 32 bit and compat).

Either way should work though.

Quoted 9 lines
Quoted 4 lines

It seems that this file fits in the same category as the backtrace code. Maybe move both away from arch/tile/kernel into a different directory?

I'll think about it. These are both basically disassembly-related, so maybe an arch/tile/disasm directory with the tile_desc stuff and the backtracer? I'm not sure it's really worth moving out of arch/tile/kernel though.

Ok. If you leave them in the directory, just split them out into a separate patch on your next submission then.

Arnd

#25 lore raw
Quoted 9 lines · Arnd Bergmann
Quoted 7 lines · Chris Metcalf

The thing is, the COMPAT layer on TILE-Gx is actually not providing TILEPro compatibility, since the architectures are too different -- conceptually similar but with different opcode numbering, etc. Instead what it's doing is providing a 32-bit pointer ABI, to help porting crufty old code (this is in fact the primary customer driver), or to allow more compact representations of pointer-heavy data.

Quoted 6 lines

[...]
Are you able to build 32 bit kernels for TILE-Gx as well? It's probably something you never really want to do for performance reasons, but I guess you could use that to verify that the ABI is really compatible.

No, we haven't tried to do this. I suppose it would be possible to port the TILE-Gx kernel to use -m32 mode and HIGHMEM, but I think it would just uglify the code. :-)

Quoted 6 lines

What I meant about compat_sys_sendfile is that you only define it if the 32 bit ABI contains a reference to sys_sendfile in the first place. With asm-generic/unistd.h, 32 bit uses always uses the sys_sendfile64 kernel interface, while for 64 bit the two are identical, so we take the regular sys_sendfile.

Right, true enough. I'm still building internally with __ARCH_WANT_SYSCALL_OFF_T, so some extra compat functions are still needed for linking the kernel. I'll try to remember to unifdef them out of the code I submit back to the community.

Quoted 10 lines
Quoted 3 lines

The notion of using a file descriptor as the "rights" object is pretty central, so I think a character device will work out well.

ok, I see. Now you could easily do this with system calls as well:
Instead of the initial ioctl that associates the file descriptor with a rectangle, you can have a syscall that creates a rectangle and a file descriptor (using anon_inode_getfd) associated with it, and returns the fd to user space. This is similar to what we do for other system call interfaces that operate on their own fds.

Yes, good point. I'll be holding back this code from the initial patch, so I can think about it some more. I'm still predisposed to avoid adding system calls in general, though.

Quoted 3 lines

On a chardev, a binary interface seems more appropriate than
an text based one anyway, so you could add another ioctl for this.ok. Then please just use .unlocked_ioctl in new drivers.

OK, I bombed all our existing drivers to use .unlocked_ioctl. It's convenient that unlocked_ioctl now has the same signature as compat_ioctl.

Quoted 5 lines

Ok. Do you use huge pages for backing the linear kernel mapping? Normally device drivers get huge pages for free in kmalloc and get_free_pages because all the memory is mapped using the largest page size anyway.

We do now. At the time we (semi-speculatively) wrote the hugevmap code, we didn't. I won't return this code to the community until we actually use it, in any case.

Quoted 16 lines
Quoted 11 lines
Quoted 11 lines

+EXPORT_SYMBOL(inb);

If you just remove these definitions, you get a link error for any driver that tries to use these, which is probably more helpful than the panic.

OTOH, are you sure that you can't just map the PIO calls to mmio functions like readb plus some fixed offset? On most non-x86 architectures, the PIO area of the PCI bus is just mapped to a memory range somewhere.

Quoted 5 lines

I'll try to remove them and see if anything falls over. We don't have any memory-mapped addresses in the 32-bit architecture, though that changes with the 64-bit architecture, which introduces IO mappings. For PCI we actually have to do a hypervisor transaction for reads or writes.

Quoted 5 lines

Ok, then I assume that PIO would also be a hypervisor call, right? If you don't have MMIO on 32 bit, you might want to not define either PIO (inb, ...) no MMIO (readb, ...) calls there and disable CONFIG_HAVE_MMIO in Kconfig.

We don't define CONFIG_HAVE_MMIO, but drivers certainly seem to use ioread/iowrite methods as well as inb/outb without guarding them with any particular tests, so we have to provide definitions of some kind for all of them. I'll confer with our PCI developer to see if we can clean up the set of definitions in io.h.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Does this need to be a system call? I thought we already had other architectures without floating point exceptions in hardware that don't need this.

Quoted 8 lines
Quoted 5 lines

Hmm, I didn't know about that. Any information would be appreciated. I guess you could synthesize something that looked like a signal purely in user-space? But how would debuggers trap it? I'm not sure how it would work without a system call.

I think the C99 standard allows you to not implement SIGFPE at all but instead rely on applications doing fetestexcept() etc.

We use this not for the floating-point operations, but for integer divide-by-zero. In principle we could use it for floating-point too, but we currently don't, since generally folks don't expect it there.

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

arch/tile/kernel/sys.c

Quoted 9 lines
arch/tile/kernel/sys.c +5 -0
[...]
+ssize_t sys32_readahead(int fd, u32 offset_lo, u32 offset_hi, u32 count)
+{
+    return sys_readahead(fd, ((loff_t)offset_hi << 32) | offset_lo, count);
+}
+

These seem to belong with the other similar functions in compat.c

Quoted 9 lines
Quoted 3 lines

Except they're also used by the 32-bit platform where there is no compat mode (the compat code DOES use them too, it's true).

I see. AFAICT, all other architectures don't need the wrapper in the 32 bit native case because they define the syscall calling conventions in libc such that they match what the kernel expects for a 64 bit argument (typically split in two subsequent argument slots). Would that work for you as well?

Yes, we could override this in libc. My assumption was that it was cleaner to do it in the kernel, since we support uclibc and glibc, and doing it in the kernel meant only doing it in one place.

Quoted 12 lines
Quoted 7 lines
Quoted 7 lines

Just use the sys_mmap_pgoff system call directly, rather than defining your own wrappers. Since that syscall is newer than asm-generic/unistd.h, that file might need some changes, together with fixes to arch/score to make sure we don't break its ABI.

Quoted 5 lines

It should be OK. Their sys_mmap2() just tail-calls sys_mmap_pgoff() anyway, so it should be possible to switch mmap2 in asm-generic/unistd.h to be mmap_pgoff instead. We'll need some user-space changes (our mmap2 is defined in 4KB units) but that's not hard.

Quoted 6 lines

Hmm, I forgot about the page size. Actually the definition of sys_mmap2 is to use 4KB units on all architectures except ia64, independent of the real page size. Maybe it's better to keep using sys_mmap/sys_mmap2 after all but then use only one of the two (sys_mmap on 64 bit, sys_mmap2 on 32 bit and compat).

I'll keep it as-is, then. Like the sendfile discussion above, we'll need both for now, but I'll see if I can unifdef the unwanted ones out for the community.

Quoted 8 lines
Quoted 5 lines

I'll think about it. These are both basically disassembly-related, so maybe an arch/tile/disasm directory with the tile_desc stuff and the backtracer? I'm not sure it's really worth moving out of arch/tile/kernel though.

Ok. If you leave them in the directory, just split them out into a separate patch on your next submission then.

Does this imply separate git commits to our repository, if we want to do things the Right Way? I always tend to try to commit things in such a way that everything is always buildable between each commit, and I can't easily pull out the disassembly-related files from the kernel. On the other hand I can easily split up a single bit GIT commit-patch into multiple emails, but then of course it wouldn't apply easily to a "git am". Guidance?? :-)

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#26 lore raw
Quoted 24 lines · Chris Metcalf
Quoted 17 lines · Arnd Bergmann
Quoted 11 lines · Chris Metcalf
Quoted 11 lines

+EXPORT_SYMBOL(inb);

If you just remove these definitions, you get a link error for any driver that tries to use these, which is probably more helpful than the panic.

OTOH, are you sure that you can't just map the PIO calls to mmio functions like readb plus some fixed offset? On most non-x86 architectures, the PIO area of the PCI bus is just mapped to a memory range somewhere.

Quoted 5 lines

I'll try to remove them and see if anything falls over.  We don't have any memory-mapped addresses in the 32-bit architecture, though that changes with the 64-bit architecture, which introduces IO mappings.  For PCI we actually have to do a hypervisor transaction for reads or writes.

Quoted 5 lines

Ok, then I assume that PIO would also be a hypervisor call, right? If you don't have MMIO on 32 bit, you might want to not define either PIO (inb, ...) no MMIO (readb, ...) calls there and disable CONFIG_HAVE_MMIO in Kconfig.

Quoted 5 lines

We don't define CONFIG_HAVE_MMIO, but drivers certainly seem to use ioread/iowrite methods as well as inb/outb without guarding them with any particular tests, so we have to provide definitions of some kind for all of them.  I'll confer with our PCI developer to see if we can clean up the set of definitions in io.h.

It's CONFIG_NO_IOMEM (cfr. s390 and um), which is inverted and turned into CONFIG_HAS_IOMEM, to be checked by drivers.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#27 lore raw
Quoted 25 lines · Geert Uytterhoeven
Quoted 24 lines · Chris Metcalf
Quoted 22 lines · Arnd Bergmann
Quoted 11 lines · Chris Metcalf
Quoted 11 lines

+EXPORT_SYMBOL(inb);

If you just remove these definitions, you get a link error for any driver that tries to use these, which is probably more helpful than the panic.

OTOH, are you sure that you can't just map the PIO calls to mmio functions like readb plus some fixed offset? On most non-x86 architectures, the PIO area of the PCI bus is just mapped to a memory range somewhere.

Quoted 5 lines

I'll try to remove them and see if anything falls over. ??We don't have any memory-mapped addresses in the 32-bit architecture, though that changes with the 64-bit architecture, which introduces IO mappings. ??For PCI we actually have to do a hypervisor transaction for reads or writes.

Ok, then I assume that PIO would also be a hypervisor call, right? If you don't have MMIO on 32 bit, you might want to not define either PIO (inb, ...) no MMIO (readb, ...) calls there and disable CONFIG_HAVE_MMIO in Kconfig.

Quoted 9 lines
Quoted 5 lines

We don't define CONFIG_HAVE_MMIO, but drivers certainly seem to use ioread/iowrite methods as well as inb/outb without guarding them with any particular tests, so we have to provide definitions of some kind for all of them. ??I'll confer with our PCI developer to see if we can clean up the set of definitions in io.h.

It's CONFIG_NO_IOMEM (cfr. s390 and um), which is inverted and turned into CONFIG_HAS_IOMEM, to be checked by drivers.

Likewise for CONFIG_NO_IOPORT for disabling PIO, although you'll probably want to conditionalize this on PCI I/O.

maintainer
#28 lore raw
In reply to Chris Metcalf
Quoted 10 lines · Chris Metcalf
Quoted 5 lines · Arnd Bergmann

Are you able to build 32 bit kernels for TILE-Gx as well? It's probably something you never really want to do for performance reasons, but I guess you could use that to verify that the ABI is really compatible.

No, we haven't tried to do this. I suppose it would be possible to port the TILE-Gx kernel to use -m32 mode and HIGHMEM, but I think it would just uglify the code. :-)

Probably right, yes.

Quoted 11 lines
Quoted 10 lines
Quoted 3 lines

The notion of using a file descriptor as the "rights" object is pretty central, so I think a character device will work out well.

ok, I see. Now you could easily do this with system calls as well:
Instead of the initial ioctl that associates the file descriptor with a rectangle, you can have a syscall that creates a rectangle and a file descriptor (using anon_inode_getfd) associated with it, and returns the fd to user space. This is similar to what we do for other system call interfaces that operate on their own fds.

Quoted 3 lines

Yes, good point. I'll be holding back this code from the initial patch, so I can think about it some more. I'm still predisposed to avoid adding system calls in general, though.

Well, adding chardevs just for the sake of doing ioctl in place of a syscall is no better than adding the real syscall for something that should be one.
It has all the disadvantages of new syscalls but does it in a sneaky way.

Quoted 11 lines
Quoted 10 lines
Quoted 5 lines

I'll try to remove them and see if anything falls over. We don't have any memory-mapped addresses in the 32-bit architecture, though that changes with the 64-bit architecture, which introduces IO mappings. For PCI we actually have to do a hypervisor transaction for reads or writes.

Ok, then I assume that PIO would also be a hypervisor call, right? If you don't have MMIO on 32 bit, you might want to not define either PIO (inb, ...) no MMIO (readb, ...) calls there and disable CONFIG_HAVE_MMIO in Kconfig.

Quoted 5 lines

We don't define CONFIG_HAVE_MMIO, but drivers certainly seem to use ioread/iowrite methods as well as inb/outb without guarding them with any particular tests, so we have to provide definitions of some kind for all of them. I'll confer with our PCI developer to see if we can clean up the set of definitions in io.h.

As Geert mentioned, I meant CONFIG_HAS_IOMEM. If that is disabled, no code should ever call any of these functions.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Hmm, I didn't know about that. Any information would be appreciated. I guess you could synthesize something that looked like a signal purely in user-space? But how would debuggers trap it? I'm not sure how it would work without a system call.

Quoted 7 lines
Quoted 3 lines

I think the C99 standard allows you to not implement SIGFPE at all but instead rely on applications doing fetestexcept() etc.

We use this not for the floating-point operations, but for integer divide-by-zero. In principle we could use it for floating-point too, but we currently don't, since generally folks don't expect it there.

Ah, I see. That probably makes a lot of sense to present as a signal the way you do.

Quoted 10 lines
Quoted 9 lines
Quoted 3 lines

Except they're also used by the 32-bit platform where there is no compat mode (the compat code DOES use them too, it's true).

I see. AFAICT, all other architectures don't need the wrapper in the 32 bit native case because they define the syscall calling conventions in libc such that they match what the kernel expects for a 64 bit argument (typically split in two subsequent argument slots). Would that work for you as well?

Quoted 3 lines

Yes, we could override this in libc. My assumption was that it was cleaner to do it in the kernel, since we support uclibc and glibc, and doing it in the kernel meant only doing it in one place.

That's not the way I meant. There are two options how (any) libc can implement this:
1. the calling conventions for user function calls and for kernel function calls are the same, so you don't need to do anything here.
2. the calling conventions are different, so you already need a wrapper in user space for 64 bit arguments to split them up and you could to that in exactly the way that the kernel expects to be called.

Quoted 9 lines
Quoted 8 lines
Quoted 5 lines

I'll think about it. These are both basically disassembly-related, so maybe an arch/tile/disasm directory with the tile_desc stuff and the backtracer? I'm not sure it's really worth moving out of arch/tile/kernel though.

Ok. If you leave them in the directory, just split them out into a separate patch on your next submission then.

Quoted 7 lines

Does this imply separate git commits to our repository, if we want to do things the Right Way? I always tend to try to commit things in such a way that everything is always buildable between each commit, and I can't easily pull out the disassembly-related files from the kernel. On the other hand I can easily split up a single bit GIT commit-patch into multiple emails, but then of course it wouldn't apply easily to a "git am". Guidance?? :-)

You're right that any commit should result in something that's buildable. In this case I think you can make an exception because before the first patch, nothing builds in arch/tile, so you extend that phase to two or three patches before you get to the first one that's actually compilable.

Arnd

#29 lore raw
Quoted 11 lines · Arnd Bergmann
Quoted 11 lines
Quoted 10 lines
Quoted 5 lines
Quoted 5 lines

I see. AFAICT, all other architectures don't need the wrapper in the 32 bit native case because they define the syscall calling conventions in libc such that they match what the kernel expects for a 64 bit argument (typically split in two subsequent argument slots). Would that work for you as well?

Yes, we could override this in libc. My assumption was that it was cleaner to do it in the kernel, since we support uclibc and glibc, and doing it in the kernel meant only doing it in one place.

Quoted 8 lines

That's not the way I meant. There are two options how (any) libc can implement this:
1. the calling conventions for user function calls and for kernel function calls are the same, so you don't need to do anything here.
2. the calling conventions are different, so you already need a wrapper in user space for 64 bit arguments to split them up and you could to that in exactly the way that the kernel expects to be called.

The issue is that libc support for 64-bit operands on 32-bit platforms tends to look like "syscall(foo64, arg1, LOW(arg2), HIGH(arg2))". This naturally passes the arguments in consecutive registers, for a register-based calling convention like ours. However, invoking "foo64(arg1, (u64)arg2)" passes the u64 argument in the next consecutive even/odd numbered pair of registers on our architecture. Arguably this notion of register alignment isn't particularly helpful, but we opted to do it this way when we settled on the API. The upshot is that to match this, userspace needs to do "syscall(foo64, arg1, dummy, LOW(arg2), HIGH(arg2))". So we need to provide these dummy-argument versions of the syscall wrappers to all the libcs that we use (currently uclibc, glibc, and sometimes newlib). Where the 64-bit argument falls naturally on an even register boundary we don't need to provide any kernel stub.

Basically the scenario is your #2 above, but userspace already has an implementation of the user-space wrapper in the generic code, and I'm trying to avoid having to provide a tile-specific version of it.

For reference, here's readahead() in glibc (overridden to be a pure syscall wrapper for 64-bit architectures):

ssize_t
__readahead (int fd, off64_t offset, size_t count) {
return INLINE_SYSCALL (readahead, 4, fd,

                         __LONG_LONG_PAIR ((off_t) (offset >> 32),
                                           (off_t) (offset & 0xffffffff)),
                         count);
}
Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
maintainer
#30 lore raw
Quoted 15 lines · Chris Metcalf

On 5/27/2010 10:11 AM, Arnd Bergmann wrote:

The issue is that libc support for 64-bit operands on 32-bit platforms tends to look like "syscall(foo64, arg1, LOW(arg2), HIGH(arg2))". This naturally passes the arguments in consecutive registers, for a register-based calling convention like ours. However, invoking "foo64(arg1, (u64)arg2)" passes the u64 argument in the next consecutive even/odd numbered pair of registers on our architecture. Arguably this notion of register alignment isn't particularly helpful, but we opted to do it this way when we settled on the API. The upshot is that to match this, userspace needs to do "syscall(foo64, arg1, dummy, LOW(arg2), HIGH(arg2))". So we need to provide these dummy-argument versions of the syscall wrappers to all the libcs that we use (currently uclibc, glibc, and sometimes newlib). Where the 64-bit argument falls naturally on an even register boundary we don't need to provide any kernel stub.

ok, makes sense. IIRC, the s390 architecture has the same requirement, probably some others as well.

Quoted 7 lines

Basically the scenario is your #2 above, but userspace already has an implementation of the user-space wrapper in the generic code, and I'm trying to avoid having to provide a tile-specific version of it.

For reference, here's readahead() in glibc (overridden to be a pure syscall wrapper for 64-bit architectures):

Quoted 8 lines

ssize_t
__readahead (int fd, off64_t offset, size_t count) {
return INLINE_SYSCALL (readahead, 4, fd,

                         __LONG_LONG_PAIR ((off_t) (offset >> 32),
                                           (off_t) (offset & 0xffffffff)),
                         count);
}

Ok, I see. No objection to your kernel code then, we just need to figure out how to do that with the generic sys_call_table.

Arnd

#31 lore raw
Quoted 3 lines · Arnd Bergmann

Ok, I see. No objection to your kernel code then, we just need to figure out how to do that with the generic sys_call_table.

That turns out to be fairly easy:

#undef __SYSCALL
#define __SYSCALL(nr, call) [nr] = (call),

#ifndef __tilegx__
#define sys_fadvise64 sys32_fadvise64
#define sys_fadvise64_64 sys32_fadvise64_64
#define sys_readahead sys32_readahead
#endif

void *sys_call_table[__NR_syscalls] = {
	[0 ... __NR_syscalls-1] = sys_ni_syscall,

#include <asm/unistd.h>
};

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
maintainer
#32 lore raw
Quoted 11 lines · Chris Metcalf

That turns out to be fairly easy:

#undef __SYSCALL
#define __SYSCALL(nr, call) [nr] = (call),

#ifndef __tilegx__
#define sys_fadvise64 sys32_fadvise64
#define sys_fadvise64_64 sys32_fadvise64_64
#define sys_readahead sys32_readahead
#endif

Quoted 5 lines
void *sys_call_table[__NR_syscalls] = {
        [0 ... __NR_syscalls-1] = sys_ni_syscall,

#include <asm/unistd.h>
};

Ok. This does mean that you're no longer using a shared version of the sys_call_table.c file but your own one, but since the file so simple, that should not be a problem.

We can think about merging it when we have more architectures that need a hack like this, which might never happen.

Arnd

#33 lore raw
In reply to Arnd Bergmann
Quoted 10 lines · [email protected] wrote:
Quoted 9 lines · Chris Metcalf
Quoted 7 lines · Arnd Bergmann
Quoted 4 lines

Hmm, I didn't know about that. Any information would be appreciated. I guess you could synthesize something that looked like a signal purely in user-space? But how would debuggers trap it? I'm not sure how it would work without a system call.

I think the C99 standard allows you to not implement SIGFPE at all but instead rely on applications doing fetestexcept() etc.

Quoted 6 lines
Quoted 3 lines

We use this not for the floating-point operations, but for integer divide-by-zero. In principle we could use it for floating-point too, but we currently don't, since generally folks don't expect it there.

Ah, I see. That probably makes a lot of sense to present as a signal the way you do.

FWIW, this can also be done using some recognizable illegal instruction sequence, if the architecture reserves some opcodes as always illegal. This makes the division routine (typically part of libgcc) more independent of OS, which has some merit. The kernel illegal instruction handler needs to recognize this sequence and turn it into a SIGFPE instead of SIGILL.

The Xtensa architecture libgcc added this recently, but we haven't yet added the SIGILL=>SIGFPE code to the kernel.

-Marc

#34 lore raw
Quoted 10 lines · Marc Gauthier
Quoted 7 lines
Quoted 4 lines

We use [a syscall] not for the floating-point operations, but for integer divide-by-zero. In principle we could use it for floating-point too, but we currently don't, since generally folks don't expect it there.

Ah, I see. That probably makes a lot of sense to present as a signal the way you do.

FWIW, this can also be done using some recognizable illegal instruction sequence, if the architecture reserves some opcodes as always illegal.

We do reserve a range of illegal values, and this is a great idea. I've removed the syscall from our kernel, and will add support for the appropriate magic in the trap handler once we pick an encoding and give it a name in the assembler.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#35 lore raw
In reply to Arnd Bergmann
Quoted 6 lines · Arnd Bergmann

You're right that any commit should result in something that's buildable. In this case I think you can make an exception because before the first patch, nothing builds in arch/tile, so you extend that phase to two or three patches before you get to the first one that's actually compilable.

OK, will do. I'm also planning to do a hard git reset to remove the original patch, since much of it is no longer wanted anyway. I'll mail out a diff of what has changed relative to that original submission as just a regular "diff -ru" so previous reviewers can see what has changed.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#36 lore raw
In reply to Arnd Bergmann
Quoted 32 lines · Arnd Bergmann
Quoted 11 lines · Chris Metcalf
Quoted 4 lines

Yes, that makes sense. You definitely want binary compatibility between 32 bit binaries from a native 32 bit system on TILE-Gx in the syscall interface.

The thing is, the COMPAT layer on TILE-Gx is actually not providing TILEPro compatibility, since the architectures are too different -- conceptually similar but with different opcode numbering, etc. Instead what it's doing is providing a 32-bit pointer ABI, to help porting crufty old code (this is in fact the primary customer driver), or to allow more compact representations of pointer-heavy data.

Ah, interesting. I don't think any architecture does it this way so far. IIRC, while alpha had some applications built in 32 bit mode in the early days, those were just using the 64 bit system calls directly.

Then again, that probably required some rather ugly hacks to get the libc working, so since we have the compat code in kernel now, your approach is probably much better.

Are you able to build 32 bit kernels for TILE-Gx as well? It's probably something you never really want to do for performance reasons, but I guess you could use that to verify that the ABI is really compatible.

Quoted 5 lines
Quoted 4 lines

compat_sys_sendfile will not be needed with the asm-generic/unistd.h definitions, but I think you will still need a compat_sys_sendfile64, to which the same applies as to compat_sys_sched_rr_get_interval.

Quoted 7 lines
Quoted 3 lines

I think it's the other way around: compat_sys_sendfile64() is just sys_sendfile64(), but compat_sys_sendfile() needs to exist since it has to write a 32-bit pointer back to userspace.

Ah. I guess you're right about compat_sys_sendfile64 not being needed. Funny enough, parisc, powerpc, s390 and sparc all define it anyway, so it didn't occur to me that they don't actually need to.

They do need it.

For example, on Sparc, compat_sys_sendfile64 takes a 32-bit compat_size_t argument, and calls sys_sendfile64 with a 64-bit size_t argument.

I'll be very surprised if 32-bit tile is using 64-bit size_t already :-)

-- Jamie

Quoted 258 lines

What I meant about compat_sys_sendfile is that you only define it if the 32 bit ABI contains a reference to sys_sendfile in the first place. With asm-generic/unistd.h, 32 bit uses always uses the sys_sendfile64 kernel interface, while for 64 bit the two are identical, so we take the regular sys_sendfile.

Quoted 32 lines
Quoted 8 lines

Review

Quoted 5 lines
(quoted diff) +3 -0
+static int hardwall_ioctl(struct inode *inode, struct file *file,
+                      unsigned int a, unsigned long b)
+{
[...]

The hardwall stuff looks like it is quite central to your architecture. Could you elaborate on what it does?

It's not "central" but it is an important enabler for access to our "user network". This is a wormhole-routed mesh network (the UDN, or user dynamic network) that connects all the cpus. If a task affinitizes itself to a single cpu (to avoid migration) and opens /dev/hardwall and does an ioctl on it, it can associate the particular /dev/hardwall file object with some non-overlapping subrectangle of the whole 8x8 chip (our cpus are laid out as "tiles" in an 8x8 configuration). It can then do an "activate" ioctl to get access to that subrectangle of the UDN, from that cpu. Other threads in that process (or anyone who can share that file object one way or another, e.g. fork or sendmsg) can then also do an "activate" ioctl on that file object and also get access, and they can then exchange messages with very low latency (register file to register file in a handful of cycles) and high bandwidth (32 bits/cycle or about 3GB/sec).

The actual "hardwall" refers to the fact that cpus on the periphery of the allocated subrectangle of cpus set up the router so that they will get an interrupt if some cpu tries to send a message that would terminate outside the set of allocated cpus. Doing it this way means several unrelated tasks could have separate message-passing arenas (spatially dividing the chip) and whenever the last task holding a reference to a hardwall file object exits, the OS can drain any messages from the UDN and deallocate the subrectangle in question.

Quoted 6 lines
Quoted 3 lines

If it is as essential as it looks, I'd vote for promoting the interface from an ioctl based one to four real system calls (more if necessary).

The notion of using a file descriptor as the "rights" object is pretty central, so I think a character device will work out well.

ok, I see. Now you could easily do this with system calls as well:
Instead of the initial ioctl that associates the file descriptor with a rectangle, you can have a syscall that creates a rectangle and a file descriptor (using anon_inode_getfd) associated with it, and returns the fd to user space. This is similar to what we do for other system call interfaces that operate on their own fds.

Another alternative might be to combine this with cpusets subsystem, which has a related functionality. I guess that would be the preferred way if you expect tile-gx to take over the world and have lots of applications written to it.
For a niche product, the syscall or ioctl approach does seem simple enough, and it does not require other users of cpusets to learn about requirements of your rectangles.

Quoted 10 lines
Quoted 5 lines

Note that the procfs file format is part of your ABI, and this looks relatively hard to parse, which may introduce bugs.
For per-process information, it would be better to have a simpler file in each /proc/<pid>/directory. Would that work for you?

Well, the hardwalls aren't exactly per-process anyway, and we don't in practice use the ASCII output for anything much, so it may not matter that they're not too parseable. I may just look into making them more parsable when I convert it to a /dev interface and leave it at that.

On a chardev, a binary interface seems more appropriate than an text based one anyway, so you could add another ioctl for this.

Quoted 3 lines

I'm planning to defer this in any case, since the UDN interface, though a nice-to-have, obviously isn't needed to run any standard C code. I'll make that part of a follow-up patch.

ok

Quoted 6 lines
Quoted 3 lines

Note that we're about to remove the .ioctl file operation and replace it with .unlocked_ioctl everywhere.

OK, for now I'll ensure that we are locking everything internally correctly. I believe we are already anyway.

ok. Then please just use .unlocked_ioctl in new drivers.

Quoted 8 lines
Quoted 4 lines

[hugevmap] Not used anywhere apparently. Can you explain what this is good for? Maybe leave it out for now, until you merge the code that needs it. I don't see anything obviously wrong with the implementation though.

I'll omit it; we haven't used it yet. The intent was to provide guaranteed huge pages for TLB purposes to kernel drivers. Currently we just start with huge pages where possible, and fragment them if necessary.

Ok. Do you use huge pages for backing the linear kernel mapping? Normally device drivers get huge pages for free in kmalloc and get_free_pages because all the memory is mapped using the largest page size anyway.

Quoted 11 lines
Quoted 10 lines

+EXPORT_SYMBOL(inb);

If you just remove these definitions, you get a link error for any driver that tries to use these, which is probably more helpful than the panic.

OTOH, are you sure that you can't just map the PIO calls to mmio functions like readb plus some fixed offset? On most non-x86 architectures, the PIO area of the PCI bus is just mapped to a memory range somewhere.

Quoted 4 lines

I'll try to remove them and see if anything falls over. We don't have any memory-mapped addresses in the 32-bit architecture, though that changes with the 64-bit architecture, which introduces IO mappings. For PCI we actually have to do a hypervisor transaction for reads or writes.

Ok, then I assume that PIO would also be a hypervisor call, right? If you don't have MMIO on 32 bit, you might want to not define either PIO (inb, ...) no MMIO (readb, ...) calls there and disable CONFIG_HAVE_MMIO in Kconfig.

Quoted 10 lines
Quoted 7 lines

Review

Quoted 5 lines
(quoted diff) +3 -0
+SEQ_PROC_ENTRY(interrupts)
+static int proc_tile_interrupts_show(struct seq_file *sf, void *v)
+{
[...]

Can you merge this with /proc/interrupts?

It turns out /proc/interrupts is formatted the wrong way round if you have 64 processors :-) You want one row per cpu, not one column per cpu!

Yes, interesting observation. I'm sure the Altix folks are suffering from this a lot.

Quoted 3 lines

Also, there are things listed that are not strictly IRQs in the normal sense (things like TLB flushes and syscalls) which are still good for assessing where latency glitches might be coming from on a particular cpu.

That's fine, just look at what a current x86 kernel gives you (slightly cut):
CPU0 CPU1

  0:   18764948     504980   IO-APIC-edge      timer
  1:     228456       2572   IO-APIC-edge      i8042
  9:    2632595      79544   IO-APIC-fasteoi   acpi
 12:    1094468      43409   IO-APIC-edge      i8042
 16:      82761       1455   IO-APIC-fasteoi   uhci_hcd:usb6, yenta, heci
 28:     908865      85857   PCI-MSI-edge      ahci
 29:       6421      11595   PCI-MSI-edge      eth0
NMI:          0          0   Non-maskable interrupts
LOC:    1987682    9057144   Local timer interrupts
SPU:          0          0   Spurious interrupts
CNT:          0          0   Performance counter interrupts
PND:          0          0   Performance pending work
RES:    3598785    3903513   Rescheduling interrupts
CAL:       8848       5944   Function call interrupts
TLB:      31467      18283   TLB shootdowns
TRM:          0          0   Thermal event interrupts
THR:          0          0   Threshold APIC interrupts
MCE:          0          0   Machine check exceptions
MCP:        354        346   Machine check polls
ERR:          0
MIS:          0

Lots of things in there that fit your category.

Quoted 8 lines
Quoted 4 lines

This seems to be read-only and coming from a kernel command line option, so I guess looking at /proc/cmdline would be a reasonable alternative.

I always find that kind of painful, since you have to parse it exactly as the kernel would to be sure you're getting it right; strstr() is only a 99% solution.

How about making it a module_param then? You can still see it in /sys/modules/*/parameters then, even if the code is builtin, but it won't be in the sysctl name space any more.

Quoted 8 lines
Quoted 7 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+SYSCALL_DEFINE3(raise_fpe, int, code, unsigned long, addr,
+            struct pt_regs *, regs)

Does this need to be a system call? I thought we already had other architectures without floating point exceptions in hardware that don't need this.

Quoted 4 lines

Hmm, I didn't know about that. Any information would be appreciated. I guess you could synthesize something that looked like a signal purely in user-space? But how would debuggers trap it? I'm not sure how it would work without a system call.

I think the C99 standard allows you to not implement SIGFPE at all but instead rely on applications doing fetestexcept() etc.

Quoted 12 lines
Quoted 11 lines

arch/tile/kernel/sys.c

Quoted 9 lines
arch/tile/kernel/sys.c +5 -0
[...]
+ssize_t sys32_readahead(int fd, u32 offset_lo, u32 offset_hi, u32 count)
+{
+    return sys_readahead(fd, ((loff_t)offset_hi << 32) | offset_lo, count);
+}
+

These seem to belong with the other similar functions in compat.c

Quoted 2 lines

Except they're also used by the 32-bit platform where there is no compat mode (the compat code DOES use them too, it's true).

I see. AFAICT, all other architectures don't need the wrapper in the 32 bit native case because they define the syscall calling conventions in libc such that they match what the kernel expects for a 64 bit argument (typically split in two subsequent argument slots). Would that work for you as well?

Quoted 11 lines
Quoted 6 lines

Just use the sys_mmap_pgoff system call directly, rather than defining your own wrappers. Since that syscall is newer than asm-generic/unistd.h, that file might need some changes, together with fixes to arch/score to make sure we don't break its ABI.

It should be OK. Their sys_mmap2() just tail-calls sys_mmap_pgoff() anyway, so it should be possible to switch mmap2 in asm-generic/unistd.h to be mmap_pgoff instead. We'll need some user-space changes (our mmap2 is defined in 4KB units) but that's not hard.

Hmm, I forgot about the page size. Actually the definition of sys_mmap2 is to use 4KB units on all architectures except ia64, independent of the real page size. Maybe it's better to keep using sys_mmap/sys_mmap2 after all but then use only one of the two (sys_mmap on 64 bit, sys_mmap2 on 32 bit and compat).

Either way should work though.

Quoted 9 lines
Quoted 4 lines

It seems that this file fits in the same category as the backtrace code. Maybe move both away from arch/tile/kernel into a different directory?

I'll think about it. These are both basically disassembly-related, so maybe an arch/tile/disasm directory with the tile_desc stuff and the backtracer? I'm not sure it's really worth moving out of arch/tile/kernel though.

Ok. If you leave them in the directory, just split them out into a separate patch on your next submission then.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#37 lore raw
Quoted 13 lines · On Thursday 27 May 2010 22:34:12 Jamie Lokier wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

compat_sys_sendfile will not be needed with the asm-generic/unistd.h definitions, but I think you will still need a compat_sys_sendfile64, to which the same applies as to compat_sys_sched_rr_get_interval.

Quoted 7 lines
Quoted 3 lines

I think it's the other way around: compat_sys_sendfile64() is just sys_sendfile64(), but compat_sys_sendfile() needs to exist since it has to write a 32-bit pointer back to userspace.

Ah. I guess you're right about compat_sys_sendfile64 not being needed. Funny enough, parisc, powerpc, s390 and sparc all define it anyway, so it didn't occur to me that they don't actually need to.

Quoted 5 lines

They do need it.

For example, on Sparc, compat_sys_sendfile64 takes a 32-bit compat_size_t argument, and calls sys_sendfile64 with a 64-bit size_t argument.

But size_t is unsigned and the upper halves of the argument registers are always zero-filled in the sparc64 compat syscall entry, so I guess the conversion is still not necessary there.

PowerPC probably still needs it but doesn't need to do the nasty set_fs() stuff. s390x needs a proper assembly wrapper and parisc uses the same method as sparc64 IIRC.

mips and x86 already just call the native sendfile64 syscall.

Quoted 1 line

I'll be very surprised if 32-bit tile is using 64-bit size_t already :-)

** Surprise! **

Chris mentioned that the tile compat support is not actually for the native 32 bit ABI but for a third ILP32 ABI of the 64 bit Tile-GX processors. I assume all registers in this mode are 64 bit, and so are the syscall arguments.

Arnd

#38 lore raw
In reply to Arnd Bergmann
Quoted 6 lines · Arnd Bergmann
Quoted 6 lines

+u32 inb(u32 addr)

drivers/pci/quirks.c

Quoted 4 lines
drivers/pci/quirks.c +4 -0
+{
+	panic("inb not implemented");
+}
+EXPORT_SYMBOL(inb);
Quoted 8 lines

If you just remove these definitions, you get a link error for any driver that tries to use these, which is probably more helpful than the panic.

OTOH, are you sure that you can't just map the PIO calls to mmio functions like readb plus some fixed offset? On most non-x86 architectures, the PIO area of the PCI bus is just mapped to a memory range somewhere.

I looked at where inb() and friends are used, and although we can get close to not requiring them for tile, it's not quite there, and will need some further discussions on the various lists to clean up enough for our purposes. There are three problems that surface when I try to remove the inb family:

1. The ide-io-std.c file sets up the default_tp_ops, which we override in our IDE driver, but we still have to build this file, and it contains calls to inb, etc.

2. The usb pci quirks file contains some quirks that use inb and outb, and since we support PCI, we have to try to compile this file.

3. CONFIG_DEVPORT defaults to yes, unless you're M68K.

None of this seems to depend on CONFIG_HAS_IOPORT.

Our PCI driver supports IOMEM read/write, but not IOPORT.

Perhaps something like CONFIG_ARCH_PCI_HAS_NO_IOPORT or some such, and then we can disable all of the above things if that config option is present (and CONFIG_HAS_IOPORT is false also?).

For now, I'll just leave the inb/outb implementation as panic() calls.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
maintainer
#39 lore raw
Quoted 9 lines · Chris Metcalf

I looked at where inb() and friends are used, and although we can get close to not requiring them for tile, it's not quite there, and will need some further discussions on the various lists to clean up enough for our purposes. There are three problems that surface when I try to remove the inb family:

1. The ide-io-std.c file sets up the default_tp_ops, which we override in our IDE driver, but we still have to build this file, and it contains calls to inb, etc.

It's only needed in the IDE layer though and will go away once you move to an ATA driver, right?

Quoted 6 lines

2. The usb pci quirks file contains some quirks that use inb and outb, and since we support PCI, we have to try to compile this file.

3. CONFIG_DEVPORT defaults to yes, unless you're M68K.

None of this seems to depend on CONFIG_HAS_IOPORT.

All three places you have found seem to be actual bugs.

Quoted 5 lines

Our PCI driver supports IOMEM read/write, but not IOPORT.

Perhaps something like CONFIG_ARCH_PCI_HAS_NO_IOPORT or some such, and then we can disable all of the above things if that config option is present (and CONFIG_HAS_IOPORT is false also?).

That's what CONFIG_NO_IOPORT is supposed to be used for in the first place, so I think we should just use the existing CONFIG_HAS_IOPORT symbol to disable the broken code you found. CONFIG_DEVPORT then not even needs to check for M68K.

Arnd

#40 lore raw
Quoted 8 lines · Arnd Bergmann
Quoted 6 lines · Chris Metcalf

I looked at where inb() and friends are used, and although we can get close to not requiring them for tile, it's not quite there, and will need some further discussions on the various lists to clean up enough for our purposes. There are three problems that surface when I try to remove the inb family:

Quoted 7 lines
Quoted 4 lines

1. The ide-io-std.c file sets up the default_tp_ops, which we override in our IDE driver, but we still have to build this file, and it contains calls to inb, etc.

It's only needed in the IDE layer though and will go away once you move to an ATA driver, right?

That sounds plausible, though I haven't looked at what's involved with this yet.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#41 lore raw

PATCH 1/1 arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

In reply to Arnd Bergmann

This change introduces a few of the less controversial /proc and /proc/sys interfaces for tile, along with a sysfs attribute for something that was originally proposed as a /proc/tile file.

Arnd Bergmann reviewed the initial arch/tile submission, which included a complete set of all the /proc/tile and /proc/sys/tile knobs that we had added in a somewhat ad hoc way during initial development, and provided feedback on where most of them should go.

One knob turned out to be similar enough to the existing /proc/sys/debug/exception-trace that it was re-implemented to use that model instead (in a separate commit).

Another knob was /proc/tile/grid, which reported the "grid" dimensions of a tile chip (e.g. 8x8 processors = 64-core chip). He suggested looking at sysfs for that, so this change moves that information to a pair of sysfs attributes (chip_width and chip_height) in the /sys/devices/system/cpu directory.

The entries that don't seem to have an obvious place in /sys or elsewhere, and that are added with this patch, are:

/proc/tile/hv
Version information about the running Tilera hypervisor

/proc/tile/hvconfig
Detailed configuration description of the hypervisor config

/proc/tile/board
Information on part numbers, serial numbers, etc., of the hardware that the kernel is executing on

/proc/tile/switch
The type of control path for the onboard network switch, if any.

/proc/tile/hardwall
Information on the set of currently active hardwalls (note that the implementation is already present in arch/tile/kernel/hardwall.c; this change just enables it)

/proc/sys/tile/unaligned_fixup/
Knobs controlling the kernel code to fix up unaligned exceptions

---
 arch/tile/kernel/Makefile |    2 +-
 arch/tile/kernel/proc.c   |  178 +++++++++++++++++++++++++++++++++++++++++++++
 arch/tile/kernel/sysfs.c  |   52 +++++++++++++
 3 files changed, 231 insertions(+), 1 deletions(-)
 create mode 100644 arch/tile/kernel/sysfs.c
arch/tile/kernel/Makefile +1 -1
index b4c8e8e..b4dbc05 100644
@@ -5,7 +5,7 @@
 extra-y := vmlinux.lds head_$(BITS).o
 obj-y := backtrace.o entry.o init_task.o irq.o messaging.o \
 	pci-dma.o proc.o process.o ptrace.o reboot.o \
-	setup.o signal.o single_step.o stack.o sys.o time.o traps.o \
+	setup.o signal.o single_step.o stack.o sys.o sysfs.o time.o traps.o \
 	intvec_$(BITS).o regs_$(BITS).o tile-desc_$(BITS).o
 
 obj-$(CONFIG_HARDWALL)		+= hardwall.o
arch/tile/kernel/proc.c +178 -0

187 lines not on this page · raw message

arch/tile/kernel/sysfs.c new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
1.6.5.2
maintainer
#42 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

Quoted 10 lines · Chris Metcalf

/proc/tile/hv
Version information about the running Tilera hypervisor

/proc/tile/hvconfig
Detailed configuration description of the hypervisor config

/proc/tile/board
Information on part numbers, serial numbers, etc., of the hardware that the kernel is executing on

Quoted 7 lines

/proc/tile/switch
The type of control path for the onboard network switch, if any.

/proc/tile/hardwall
Information on the set of currently active hardwalls (note that the implementation is already present in arch/tile/kernel/hardwall.c; this change just enables it)

These all look like ideal candidates for sysfs attributes under /sys/hypervisor, doing them one value per file, instead of grouping them into multiple entries per file.

You can also turn each of these files into one directory under /sys/hypervisor, with one or more files under it.

Quoted 47 lines
arch/tile/kernel/sysfs.c new file +41 -0
new file mode 100644
index 0000000..151deeb
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2011 Tilera Corporation. All Rights Reserved.
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation, version 2.
+ *
+ *   This program is distributed in the hope that it will be useful, but
+ *   WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ *   NON INFRINGEMENT.  See the GNU General Public License for
+ *   more details.
+ *
+ * /sys entry support.
+ */
+
+#include <linux/sysdev.h>
+#include <linux/cpu.h>
+#include <linux/smp.h>
+
+static ssize_t chip_width_show(struct sysdev_class *dev,
+			       struct sysdev_class_attribute *attr,
+			       char *page)
+{
+	return sprintf(page, "%u\n", smp_width);
+}
+static SYSDEV_CLASS_ATTR(chip_width, 0444, chip_width_show, NULL);
+
+static ssize_t chip_height_show(struct sysdev_class *dev,
+				struct sysdev_class_attribute *attr,
+				char *page)
+{
+	return sprintf(page, "%u\n", smp_height);
+}
+static SYSDEV_CLASS_ATTR(chip_height, 0444, chip_height_show, NULL);
+
+
+static int __init create_cpu_entries(void)
+{
+	struct sysdev_class *cls = &cpu_sysdev_class;
+	int err = 0;

arch/tile/kernel/sysfs.c line 51

Quoted 10 lines
arch/tile/kernel/sysfs.c new file +10 -0
+
+	if (!err)
+		err = sysfs_create_file(&cls->kset.kobj,
+					&attr_chip_width.attr);
+	if (!err)
+		err = sysfs_create_file(&cls->kset.kobj,
+					&attr_chip_height.attr);
+
+	return err;
+}

This should use sysdev_create_file instead of open-coding it.

Arnd

#43 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

Quoted 10 lines · Arnd Bergmann

These all [below] look like ideal candidates for sysfs attributes under /sys/hypervisor, doing them one value per file, instead of grouping them into multiple entries per file.

You can also turn each of these files into one directory under /sys/hypervisor, with one or more files under it.

On Tuesday 17 May 2011, Chris Metcalf wrote

Quoted 2 lines

/proc/tile/hv
Version information about the running Tilera hypervisor

Yes, for "hv" this does make sense; I've coded it up. I had to add a "select SYS_HYPERVISOR" for "config TILE" since otherwise tile doesn't normally get a /sys/hypervisor directory. The upshot is /sys/hypervisor/version and /sys/hypervisor/config_version files. The "config_version" can be long (typically in the hundreds of characters) but should rarely get up to the page size, and it's probably OK to just truncate it in that case. It looks like Xen also tries to do things in this directory, but we don't currently support Xen (we're working on KVM instead) so I won't worry about it.

Quoted 2 lines
Quoted 2 lines

/proc/tile/hvconfig
Detailed configuration description of the hypervisor config

I'm concerned about moving this one out of /proc, since it's just (copious) free text. An "hvconfig" (hypervisor config) file describes hypervisor driver "dedicated tiles" that run things like network packet or PCIe ingress/egress processing, etc. In addition it lists hypervisor driver options, boot flags for the kernel, etc, all kinds of things -- and you can't really guarantee that it will fit on a 4KB page, though in practice it usually does. The hypervisor reads this file from the boot stream when it boots, and then makes it available to Linux not for Linux's use, or even for programmatic userspace use, but just for end users to be able to review and verify that the configuration they think they booted is really what they got, for customer remote debugging, etc. The "remote debugging" aspect makes truncation to page size a particularly worrisome idea.

Quoted 6 lines
Quoted 6 lines

/proc/tile/board
Information on part numbers, serial numbers, etc., of the hardware that the kernel is executing on

/proc/tile/switch
The type of control path for the onboard network switch, if any.

These two report information about the hardware, not the hypervisor. For example:

# cat /proc/tile/board
board_part: 402-00002-05
board_serial: NBS-5002-00012
chip_serial: P62338.01.110
chip_revision: A0
board_revision: 2.2
board_description: Tilera TILExpressPro-64, TILEPro64 processor (866 MHz-capable), 1 10GbE, 6 1GbE
# cat /proc/tile/switch
control: mdio gbe/0

The chip_serial and chip_revision can certainly hang off /sys/devices/system/cpu along with chip_height and chip_width (I've made this change now) but I don't know where the remaining "board" level description could go. Note that (as you can see in the source) certain boards will also include four lines of output with the "mezzanine board" part number, serial number, revision, and description; this particular example doesn't have a mezzanine board. The "switch" info is broken out into a separate file just to make it easier to script some /etc/rc code that launches a configurator for the Marvell switch on some of our boards, but is conceptually part of the board info.

Quoted 4 lines
Quoted 4 lines

/proc/tile/hardwall
Information on the set of currently active hardwalls (note that the implementation is already present in arch/tile/kernel/hardwall.c; this change just enables it)

This one is not a hypervisor-related file. It just lists information about the set of Linux hardwalls currently active. Again, it's not primarily intended for programmatic use, but as a diagnostic tool.

Quoted 13 lines
Quoted 13 lines
arch/tile/kernel/sysfs.c new file +7 -0
new file mode 100644
index 0000000..151deeb
[...]
+static int __init create_cpu_entries(void)
+{
+	struct sysdev_class *cls = &cpu_sysdev_class;
+	int err = 0;
+
+	if (!err)
+		err = sysfs_create_file(&cls->kset.kobj,
Quoted 8 lines

arch/tile/kernel/sysfs.c line 51

Quoted 7 lines
arch/tile/kernel/sysfs.c new file +7 -0
+					&attr_chip_width.attr);
+	if (!err)
+		err = sysfs_create_file(&cls->kset.kobj,
+					&attr_chip_height.attr);
+
+	return err;
+}

This should use sysdev_create_file instead of open-coding it.

My impression was that I had to associate my new attributes to the sysdev_class corresponding to "/sys/devices/system/cpu/", since I'm registering these as top-level items in the cpu directory, e.g. /sys/devices/system/cpu/chip_width; they are not properties of individual cpus. It doesn't appear that there is a sys_device corresponding to where I want to register them.

As always, thanks, Arnd!

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
maintainer
#44 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

(adding virtualization mailing list)

Quoted 4 lines · Chris Metcalf
Quoted 2 lines · Arnd Bergmann
Quoted 2 lines

/proc/tile/hvconfig
Detailed configuration description of the hypervisor config

Quoted 12 lines

I'm concerned about moving this one out of /proc, since it's just (copious) free text. An "hvconfig" (hypervisor config) file describes hypervisor driver "dedicated tiles" that run things like network packet or PCIe ingress/egress processing, etc. In addition it lists hypervisor driver options, boot flags for the kernel, etc, all kinds of things -- and you can't really guarantee that it will fit on a 4KB page, though in practice it usually does. The hypervisor reads this file from the boot stream when it boots, and then makes it available to Linux not for Linux's use, or even for programmatic userspace use, but just for end users to be able to review and verify that the configuration they think they booted is really what they got, for customer remote debugging, etc. The "remote debugging" aspect makes truncation to page size a particularly worrisome idea.

Since it's not the kernel that is imposing the format here, you could make it a binary sysfs attribute, which works in the same way as a proc file and does not have the size limitations.

Quoted 10 lines
Quoted 6 lines
Quoted 6 lines

/proc/tile/board
Information on part numbers, serial numbers, etc., of the hardware that the kernel is executing on

/proc/tile/switch
The type of control path for the onboard network switch, if any.

These two report information about the hardware, not the hypervisor. For example:

Quoted 9 lines
# cat /proc/tile/board
board_part: 402-00002-05
board_serial: NBS-5002-00012
chip_serial: P62338.01.110
chip_revision: A0
board_revision: 2.2
board_description: Tilera TILExpressPro-64, TILEPro64 processor (866 MHz-capable), 1 10GbE, 6 1GbE
# cat /proc/tile/switch
control: mdio gbe/0

I think it's ok to have it below /sys/hypervisor, because the information is provided through a hypervisor ABI, even though it describes something else. This is more like /sys/firmware, but the boundaries between that and /sys/hypervisor are not clearly defined when running virtualized anyway.

Quoted 11 lines

The chip_serial and chip_revision can certainly hang off /sys/devices/system/cpu along with chip_height and chip_width (I've made this change now) but I don't know where the remaining "board" level description could go. Note that (as you can see in the source) certain boards will also include four lines of output with the "mezzanine board" part number, serial number, revision, and description; this particular example doesn't have a mezzanine board. The "switch" info is broken out into a separate file just to make it easier to script some /etc/rc code that launches a configurator for the Marvell switch on some of our boards, but is conceptually part of the board info.

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

/proc/tile/hardwall
Information on the set of currently active hardwalls (note that the implementation is already present in arch/tile/kernel/hardwall.c; this change just enables it)

This one is not a hypervisor-related file. It just lists information about the set of Linux hardwalls currently active. Again, it's not primarily intended for programmatic use, but as a diagnostic tool.

same here, I'd still put it into the hypervisor structure.

Arnd

maintainer
#45 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

In reply to Chris Metcalf

(adding virtualization mailing list)

Quoted 4 lines · Chris Metcalf
Quoted 2 lines · Arnd Bergmann
Quoted 2 lines

/proc/tile/hvconfig
Detailed configuration description of the hypervisor config

Quoted 12 lines

I'm concerned about moving this one out of /proc, since it's just (copious) free text. An "hvconfig" (hypervisor config) file describes hypervisor driver "dedicated tiles" that run things like network packet or PCIe ingress/egress processing, etc. In addition it lists hypervisor driver options, boot flags for the kernel, etc, all kinds of things -- and you can't really guarantee that it will fit on a 4KB page, though in practice it usually does. The hypervisor reads this file from the boot stream when it boots, and then makes it available to Linux not for Linux's use, or even for programmatic userspace use, but just for end users to be able to review and verify that the configuration they think they booted is really what they got, for customer remote debugging, etc. The "remote debugging" aspect makes truncation to page size a particularly worrisome idea.

Since it's not the kernel that is imposing the format here, you could make it a binary sysfs attribute, which works in the same way as a proc file and does not have the size limitations.

Quoted 10 lines
Quoted 6 lines
Quoted 6 lines

/proc/tile/board
Information on part numbers, serial numbers, etc., of the hardware that the kernel is executing on

/proc/tile/switch
The type of control path for the onboard network switch, if any.

These two report information about the hardware, not the hypervisor. For example:

Quoted 9 lines
# cat /proc/tile/board
board_part: 402-00002-05
board_serial: NBS-5002-00012
chip_serial: P62338.01.110
chip_revision: A0
board_revision: 2.2
board_description: Tilera TILExpressPro-64, TILEPro64 processor (866 MHz-capable), 1 10GbE, 6 1GbE
# cat /proc/tile/switch
control: mdio gbe/0

I think it's ok to have it below /sys/hypervisor, because the information is provided through a hypervisor ABI, even though it describes something else. This is more like /sys/firmware, but the boundaries between that and /sys/hypervisor are not clearly defined when running virtualized anyway.

Quoted 11 lines

The chip_serial and chip_revision can certainly hang off /sys/devices/system/cpu along with chip_height and chip_width (I've made this change now) but I don't know where the remaining "board" level description could go. Note that (as you can see in the source) certain boards will also include four lines of output with the "mezzanine board" part number, serial number, revision, and description; this particular example doesn't have a mezzanine board. The "switch" info is broken out into a separate file just to make it easier to script some /etc/rc code that launches a configurator for the Marvell switch on some of our boards, but is conceptually part of the board info.

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

/proc/tile/hardwall
Information on the set of currently active hardwalls (note that the implementation is already present in arch/tile/kernel/hardwall.c; this change just enables it)

This one is not a hypervisor-related file. It just lists information about the set of Linux hardwalls currently active. Again, it's not primarily intended for programmatic use, but as a diagnostic tool.

same here, I'd still put it into the hypervisor structure.

Arnd

#46 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

Quoted 19 lines · Arnd Bergmann
Quoted 9 lines · Chris Metcalf
Quoted 6 lines
Quoted 6 lines

/proc/tile/board
Information on part numbers, serial numbers, etc., of the hardware that the kernel is executing on

/proc/tile/switch
The type of control path for the onboard network switch, if any.

These two report information about the hardware, not the hypervisor. For example:

Quoted 9 lines
# cat /proc/tile/board
board_part: 402-00002-05
board_serial: NBS-5002-00012
chip_serial: P62338.01.110
chip_revision: A0
board_revision: 2.2
board_description: Tilera TILExpressPro-64, TILEPro64 processor (866 MHz-capable), 1 10GbE, 6 1GbE
# cat /proc/tile/switch
control: mdio gbe/0
Quoted 4 lines

I think it's ok to have it below /sys/hypervisor, because the information is provided through a hypervisor ABI, even though it describes something else. This is more like /sys/firmware, but the boundaries between that and /sys/hypervisor are not clearly defined when running virtualized anyway.

I'll create a /sys/hypervisor/board/ and report the attributes there.

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

/proc/tile/hardwall
Information on the set of currently active hardwalls (note that the implementation is already present in arch/tile/kernel/hardwall.c; this change just enables it)

This one is not a hypervisor-related file. It just lists information about the set of Linux hardwalls currently active. Again, it's not primarily intended for programmatic use, but as a diagnostic tool.

same here, I'd still put it into the hypervisor structure.

Since /proc/tile/hardwall has no connection to the hypervisor whatsoever, I'm reluctant to put it under /sys/hypervisor.

Perhaps in this case it would be reasonable to just have the hardwall subsystem put the file in /proc/driver/hardwall, or even /proc/hardwall? Or I could make the /dev/hardwall char device dump out the ASCII text that we currently get from /proc/hardwall if you read from it, which is a little weird but not inconceivable. For example it currently shows things like this:

# cat /proc/tile/hardwall
2x2 1,1 pids: 484@2,1 479@1,1
2x2 0,3 pids:

In this example "2x2 1,1" is a 2x2 grid of cpus starting at grid (x,y) position (1,1), with task 484 bound to the cpu at (x,y) position (2,1).

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#47 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

In reply to Arnd Bergmann
Quoted 19 lines · Arnd Bergmann
Quoted 9 lines · Chris Metcalf
Quoted 6 lines
Quoted 6 lines

/proc/tile/board
Information on part numbers, serial numbers, etc., of the hardware that the kernel is executing on

/proc/tile/switch
The type of control path for the onboard network switch, if any.

These two report information about the hardware, not the hypervisor. For example:

Quoted 9 lines
# cat /proc/tile/board
board_part: 402-00002-05
board_serial: NBS-5002-00012
chip_serial: P62338.01.110
chip_revision: A0
board_revision: 2.2
board_description: Tilera TILExpressPro-64, TILEPro64 processor (866 MHz-capable), 1 10GbE, 6 1GbE
# cat /proc/tile/switch
control: mdio gbe/0
Quoted 4 lines

I think it's ok to have it below /sys/hypervisor, because the information is provided through a hypervisor ABI, even though it describes something else. This is more like /sys/firmware, but the boundaries between that and /sys/hypervisor are not clearly defined when running virtualized anyway.

I'll create a /sys/hypervisor/board/ and report the attributes there.

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

/proc/tile/hardwall
Information on the set of currently active hardwalls (note that the implementation is already present in arch/tile/kernel/hardwall.c; this change just enables it)

This one is not a hypervisor-related file. It just lists information about the set of Linux hardwalls currently active. Again, it's not primarily intended for programmatic use, but as a diagnostic tool.

same here, I'd still put it into the hypervisor structure.

Since /proc/tile/hardwall has no connection to the hypervisor whatsoever, I'm reluctant to put it under /sys/hypervisor.

Perhaps in this case it would be reasonable to just have the hardwall subsystem put the file in /proc/driver/hardwall, or even /proc/hardwall? Or I could make the /dev/hardwall char device dump out the ASCII text that we currently get from /proc/hardwall if you read from it, which is a little weird but not inconceivable. For example it currently shows things like this:

# cat /proc/tile/hardwall
2x2 1,1 pids: 484@2,1 479@1,1
2x2 0,3 pids:

In this example "2x2 1,1" is a 2x2 grid of cpus starting at grid (x,y) position (1,1), with task 484 bound to the cpu at (x,y) position (2,1).

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
maintainer
#48 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

Quoted 11 lines · On Friday 20 May 2011 16:26:57 Chris Metcalf wrote:
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

/proc/tile/hardwall
Information on the set of currently active hardwalls (note that the implementation is already present in arch/tile/kernel/hardwall.c; this change just enables it)

This one is not a hypervisor-related file. It just lists information about the set of Linux hardwalls currently active. Again, it's not primarily intended for programmatic use, but as a diagnostic tool.

same here, I'd still put it into the hypervisor structure.

Since /proc/tile/hardwall has no connection to the hypervisor whatsoever, I'm reluctant to put it under /sys/hypervisor.

Ah, I see. I didn't notice that it was in the other file. You are absolutely right, this does not belong into /sys/hypervisor and fits well into procfs, we just need to find the right place.

Quoted 6 lines

Perhaps in this case it would be reasonable to just have the hardwall subsystem put the file in /proc/driver/hardwall, or even /proc/hardwall? Or I could make the /dev/hardwall char device dump out the ASCII text that we currently get from /proc/hardwall if you read from it, which is a little weird but not inconceivable. For example it currently shows things like this:

Quoted 6 lines
# cat /proc/tile/hardwall
2x2 1,1 pids: 484@2,1 479@1,1
2x2 0,3 pids:

In this example "2x2 1,1" is a 2x2 grid of cpus starting at grid (x,y) position (1,1), with task 484 bound to the cpu at (x,y) position (2,1).

Any chance you can still restructure the information? I would recommend making it a first-class procfs member, since the data is really per-task.

You can add a conditional entry to tgid_base_stuff[] in fs/proc/base.c to make it show up for each pid, and then just have the per-task information in there to do the lookup the other way round:

# cat /proc/484/hardwall
2x2 1,1 @2,1
# cat /proc/479/hardwall
2x2 1,1 @1,1

Arnd

maintainer
#49 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

In reply to Chris Metcalf
Quoted 11 lines · On Friday 20 May 2011 16:26:57 Chris Metcalf wrote:
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

/proc/tile/hardwall
Information on the set of currently active hardwalls (note that the implementation is already present in arch/tile/kernel/hardwall.c; this change just enables it)

This one is not a hypervisor-related file. It just lists information about the set of Linux hardwalls currently active. Again, it's not primarily intended for programmatic use, but as a diagnostic tool.

same here, I'd still put it into the hypervisor structure.

Since /proc/tile/hardwall has no connection to the hypervisor whatsoever, I'm reluctant to put it under /sys/hypervisor.

Ah, I see. I didn't notice that it was in the other file. You are absolutely right, this does not belong into /sys/hypervisor and fits well into procfs, we just need to find the right place.

Quoted 6 lines

Perhaps in this case it would be reasonable to just have the hardwall subsystem put the file in /proc/driver/hardwall, or even /proc/hardwall? Or I could make the /dev/hardwall char device dump out the ASCII text that we currently get from /proc/hardwall if you read from it, which is a little weird but not inconceivable. For example it currently shows things like this:

Quoted 6 lines
# cat /proc/tile/hardwall
2x2 1,1 pids: 484@2,1 479@1,1
2x2 0,3 pids:

In this example "2x2 1,1" is a 2x2 grid of cpus starting at grid (x,y) position (1,1), with task 484 bound to the cpu at (x,y) position (2,1).

Any chance you can still restructure the information? I would recommend making it a first-class procfs member, since the data is really per-task.

You can add a conditional entry to tgid_base_stuff[] in fs/proc/base.c to make it show up for each pid, and then just have the per-task information in there to do the lookup the other way round:

# cat /proc/484/hardwall
2x2 1,1 @2,1
# cat /proc/479/hardwall
2x2 1,1 @1,1

Arnd

#50 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

Quoted 27 lines · Arnd Bergmann
Quoted 4 lines · On Friday 20 May 2011 16:26:57 Chris Metcalf wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

/proc/tile/hardwall
Information on the set of currently active hardwalls (note that the implementation is already present in arch/tile/kernel/hardwall.c; this change just enables it)

Ah, I see. I didn't notice that it was in the other file. You are absolutely right, this does not belong into /sys/hypervisor and fits well into procfs, we just need to find the right place.

Quoted 6 lines

Perhaps in this case it would be reasonable to just have the hardwall subsystem put the file in /proc/driver/hardwall, or even /proc/hardwall? Or I could make the /dev/hardwall char device dump out the ASCII text that we currently get from /proc/hardwall if you read from it, which is a little weird but not inconceivable. For example it currently shows things like this:

Quoted 6 lines
# cat /proc/tile/hardwall
2x2 1,1 pids: 484@2,1 479@1,1
2x2 0,3 pids:

In this example "2x2 1,1" is a 2x2 grid of cpus starting at grid (x,y) position (1,1), with task 484 bound to the cpu at (x,y) position (2,1).

Any chance you can still restructure the information? I would recommend making it a first-class procfs member, since the data is really per-task.

You can add a conditional entry to tgid_base_stuff[] in fs/proc/base.c to make it show up for each pid, and then just have the per-task information in there to do the lookup the other way round:

Quoted 5 lines
# cat /proc/484/hardwall
2x2 1,1 @2,1
# cat /proc/479/hardwall
2x2 1,1 @1,1

It's not unreasonable to do what you're suggesting, i.e. "what's this task's hardwall?", but it's not something that we've come up with any kind of use case for in the past, so I'm not currently planning to implement this. If we did, I agree, your solution looks like the right one.

The proposed /proc/tile/hardwall really is intended as system-wide information. Each hardwall (one line in the output file example above) corresponds to a "struct file" that may be shared by multiple processes (or threads). Processes may pass the "struct file" to other processes via fork (and maybe exec), or by passing it over Unix sockets. Then those processes can choose a cpu within a hardwall rectangle, affinitize to that cpu only, "activate" the hardwall fd with an ioctl(), and then get access from the OS so they can work together within a hardwall to exchange data across the Tilera "user dynamic network" (a wormhole routed grid network that moves data at 32 bits/cycle with almost no latency). Processes can create a new hardwall as long as it doesn't overlap geometrically with any other existing hardwall on the system.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#51 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

In reply to Arnd Bergmann
Quoted 27 lines · Arnd Bergmann
Quoted 4 lines · On Friday 20 May 2011 16:26:57 Chris Metcalf wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

/proc/tile/hardwall
Information on the set of currently active hardwalls (note that the implementation is already present in arch/tile/kernel/hardwall.c; this change just enables it)

Ah, I see. I didn't notice that it was in the other file. You are absolutely right, this does not belong into /sys/hypervisor and fits well into procfs, we just need to find the right place.

Quoted 6 lines

Perhaps in this case it would be reasonable to just have the hardwall subsystem put the file in /proc/driver/hardwall, or even /proc/hardwall? Or I could make the /dev/hardwall char device dump out the ASCII text that we currently get from /proc/hardwall if you read from it, which is a little weird but not inconceivable. For example it currently shows things like this:

Quoted 6 lines
# cat /proc/tile/hardwall
2x2 1,1 pids: 484@2,1 479@1,1
2x2 0,3 pids:

In this example "2x2 1,1" is a 2x2 grid of cpus starting at grid (x,y) position (1,1), with task 484 bound to the cpu at (x,y) position (2,1).

Any chance you can still restructure the information? I would recommend making it a first-class procfs member, since the data is really per-task.

You can add a conditional entry to tgid_base_stuff[] in fs/proc/base.c to make it show up for each pid, and then just have the per-task information in there to do the lookup the other way round:

Quoted 5 lines
# cat /proc/484/hardwall
2x2 1,1 @2,1
# cat /proc/479/hardwall
2x2 1,1 @1,1

It's not unreasonable to do what you're suggesting, i.e. "what's this task's hardwall?", but it's not something that we've come up with any kind of use case for in the past, so I'm not currently planning to implement this. If we did, I agree, your solution looks like the right one.

The proposed /proc/tile/hardwall really is intended as system-wide information. Each hardwall (one line in the output file example above) corresponds to a "struct file" that may be shared by multiple processes (or threads). Processes may pass the "struct file" to other processes via fork (and maybe exec), or by passing it over Unix sockets. Then those processes can choose a cpu within a hardwall rectangle, affinitize to that cpu only, "activate" the hardwall fd with an ioctl(), and then get access from the OS so they can work together within a hardwall to exchange data across the Tilera "user dynamic network" (a wormhole routed grid network that moves data at 32 bits/cycle with almost no latency). Processes can create a new hardwall as long as it doesn't overlap geometrically with any other existing hardwall on the system.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
maintainer
#52 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

Quoted 10 lines · On Friday 20 May 2011 17:00:47 Chris Metcalf wrote:
Quoted 10 lines

Any chance you can still restructure the information? I would recommend making it a first-class procfs member, since the data is really per-task.

You can add a conditional entry to tgid_base_stuff[] in fs/proc/base.c to make it show up for each pid, and then just have the per-task information in there to do the lookup the other way round:

# cat /proc/484/hardwall
2x2 1,1 @2,1
Quoted 7 lines
Quoted 2 lines
# cat /proc/479/hardwall
2x2 1,1 @1,1

It's not unreasonable to do what you're suggesting, i.e. "what's this task's hardwall?", but it's not something that we've come up with any kind of use case for in the past, so I'm not currently planning to implement this. If we did, I agree, your solution looks like the right one.

It's fairly easy to aggregate in user space though, we do similar things for 'lsof' and 'top', which walk all of procfs in order to show the complete picture. This is obviously more overhead than walking the lists in the kernel, but still not an expensive operation, and it keeps the data format much simpler.

Arnd

maintainer
#53 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

In reply to Chris Metcalf
Quoted 10 lines · On Friday 20 May 2011 17:00:47 Chris Metcalf wrote:
Quoted 10 lines

Any chance you can still restructure the information? I would recommend making it a first-class procfs member, since the data is really per-task.

You can add a conditional entry to tgid_base_stuff[] in fs/proc/base.c to make it show up for each pid, and then just have the per-task information in there to do the lookup the other way round:

# cat /proc/484/hardwall
2x2 1,1 @2,1
Quoted 7 lines
Quoted 2 lines
# cat /proc/479/hardwall
2x2 1,1 @1,1

It's not unreasonable to do what you're suggesting, i.e. "what's this task's hardwall?", but it's not something that we've come up with any kind of use case for in the past, so I'm not currently planning to implement this. If we did, I agree, your solution looks like the right one.

It's fairly easy to aggregate in user space though, we do similar things for 'lsof' and 'top', which walk all of procfs in order to show the complete picture. This is obviously more overhead than walking the lists in the kernel, but still not an expensive operation, and it keeps the data format much simpler.

Arnd

maintainer
#54 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

Quoted 19 lines · On Friday 20 May 2011 17:13:25 Arnd Bergmann wrote:
Quoted 10 lines · On Friday 20 May 2011 17:00:47 Chris Metcalf wrote:
Quoted 10 lines

Any chance you can still restructure the information? I would recommend making it a first-class procfs member, since the data is really per-task.

You can add a conditional entry to tgid_base_stuff[] in fs/proc/base.c to make it show up for each pid, and then just have the per-task information in there to do the lookup the other way round:

# cat /proc/484/hardwall
2x2 1,1 @2,1
Quoted 7 lines
Quoted 2 lines
# cat /proc/479/hardwall
2x2 1,1 @1,1

It's not unreasonable to do what you're suggesting, i.e. "what's this task's hardwall?", but it's not something that we've come up with any kind of use case for in the past, so I'm not currently planning to implement this. If we did, I agree, your solution looks like the right one.

Quoted 5 lines

It's fairly easy to aggregate in user space though, we do similar things for 'lsof' and 'top', which walk all of procfs in order to show the complete picture. This is obviously more overhead than walking the lists in the kernel, but still not an expensive operation, and it keeps the data format much simpler.

Another problem with the existing interface is that it doesn't currently support PID name spaces. That could of course be retrofitted, but having the data split by pid directory would make it work implicitly.

Another approach would be to have a /proc/hardwall/ directory with one entry per hardwall instance, and symlinks from /proc/<pid>/hardwall to the respective file.

Arnd

maintainer
#55 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

In reply to Arnd Bergmann
Quoted 19 lines · On Friday 20 May 2011 17:13:25 Arnd Bergmann wrote:
Quoted 10 lines · On Friday 20 May 2011 17:00:47 Chris Metcalf wrote:
Quoted 10 lines

Any chance you can still restructure the information? I would recommend making it a first-class procfs member, since the data is really per-task.

You can add a conditional entry to tgid_base_stuff[] in fs/proc/base.c to make it show up for each pid, and then just have the per-task information in there to do the lookup the other way round:

# cat /proc/484/hardwall
2x2 1,1 @2,1
Quoted 7 lines
Quoted 2 lines
# cat /proc/479/hardwall
2x2 1,1 @1,1

It's not unreasonable to do what you're suggesting, i.e. "what's this task's hardwall?", but it's not something that we've come up with any kind of use case for in the past, so I'm not currently planning to implement this. If we did, I agree, your solution looks like the right one.

Quoted 5 lines

It's fairly easy to aggregate in user space though, we do similar things for 'lsof' and 'top', which walk all of procfs in order to show the complete picture. This is obviously more overhead than walking the lists in the kernel, but still not an expensive operation, and it keeps the data format much simpler.

Another problem with the existing interface is that it doesn't currently support PID name spaces. That could of course be retrofitted, but having the data split by pid directory would make it work implicitly.

Another approach would be to have a /proc/hardwall/ directory with one entry per hardwall instance, and symlinks from /proc/<pid>/hardwall to the respective file.

Arnd

#56 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

Quoted 16 lines · Arnd Bergmann

Any chance you can still restructure the information? I would recommend making it a first-class procfs member, since the data is really per-task.

You can add a conditional entry to tgid_base_stuff[] in fs/proc/base.c to make it show up for each pid, and then just have the per-task information in there to do the lookup the other way round:

# cat /proc/484/hardwall
2x2 1,1 @2,1
# cat /proc/479/hardwall
2x2 1,1 @1,1
Another problem with the existing interface is that it doesn't currently
support PID name spaces. That could of course be retrofitted, but having
the data split by pid directory would make it work implicitly.
Quoted 3 lines

Another approach would be to have a /proc/hardwall/ directory with one entry per hardwall instance, and symlinks from /proc/<pid>/hardwall to the respective file.

I went ahead and implemented this, and will send out a v2 patch shortly. I added the "hardwall" entry to both the tgid_base (since everything is reflected there) but also to the tid_base_stuff[], since it can be different (in principle) for different threads.

I played around with using a symlink, but the bottom line seems to be that if I make it a symlink (via a SYM() macro in the table) it always has to exist -- so what does it point to when there's no hardwall activated? I tried making it point to /dev/null, but that just seemed silly. In the end I made /proc/PID/hardwall a file, either empty, or else containing the hardwall id.

The actual hardwalls are then in /proc/tile/hardwall/NN, where NN is the hardwall id. I wrote a very simple hardwall id allocate/free pair; the pid allocator seemed too tied to task_structs. We only need at most NR_CPUS hardwall ids, so it's pretty simple to just use a cpumask to hold the set of allocated hardwall IDs.

The contents of the hardwall ID file are then just a cpulist of the cpus covered by the hardwall, rather than introducing a new convention (as quoted above, e.g. "2x2 1,1"). Individual tasks that are in the hardwall can be found by reading the "hardwall" files, and we can learn where they are bound in the hardwall by reading the "stat" file as is normal for learning process affinity.

Quoted 5 lines

When you do a /sys/hypervisor/ interface, put everything into a subdirectory under /sys/hypervisor with the name of your hypervisor, to avoid naming conflicts, e.g.

/sys/hypervisor/tilera-hv/board/board_serial

I don't see an easy way to put a directory in /sys/hypervisor. It seems complex to create a kobject and a suitable class, etc., just for a subdirectory. Or is there something simple I'm missing? I'll keep looking.

I also suspect just "tile" is an adequate subdirectory name here in the context of /sys/hypervisor, e.g. /sys/hypervisor/tile/version.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/virtualization

#57 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

In reply to Arnd Bergmann

(Resending after marking LKML in my Thunderbird address book for "no HTML".)

Quoted 16 lines · Arnd Bergmann

Any chance you can still restructure the information? I would recommend making it a first-class procfs member, since the data is really per-task.

You can add a conditional entry to tgid_base_stuff[] in fs/proc/base.c to make it show up for each pid, and then just have the per-task information in there to do the lookup the other way round:

# cat /proc/484/hardwall
2x2 1,1 @2,1
# cat /proc/479/hardwall
2x2 1,1 @1,1
Another problem with the existing interface is that it doesn't currently
support PID name spaces. That could of course be retrofitted, but having
the data split by pid directory would make it work implicitly.
Quoted 3 lines

Another approach would be to have a /proc/hardwall/ directory with one entry per hardwall instance, and symlinks from /proc/<pid>/hardwall to the respective file.

I went ahead and implemented this, and will send out a v2 patch shortly. I added the "hardwall" entry to both the tgid_base (since everything is reflected there) but also to the tid_base_stuff[], since it can be different (in principle) for different threads.

I played around with using a symlink, but the bottom line seems to be that if I make it a symlink (via a SYM() macro in the table) it always has to exist -- so what does it point to when there's no hardwall activated? I tried making it point to /dev/null, but that just seemed silly. In the end I made /proc/PID/hardwall a file, either empty, or else containing the hardwall id.

The actual hardwalls are then in /proc/tile/hardwall/NN, where NN is the hardwall id. I wrote a very simple hardwall id allocate/free pair; the pid allocator seemed too tied to task_structs. We only need at most NR_CPUS hardwall ids, so it's pretty simple to just use a cpumask to hold the set of allocated hardwall IDs.

The contents of the hardwall ID file are then just a cpulist of the cpus covered by the hardwall, rather than introducing a new convention (as quoted above, e.g. "2x2 1,1"). Individual tasks that are in the hardwall can be found by reading the "hardwall" files, and we can learn where they are bound in the hardwall by reading the "stat" file as is normal for learning process affinity.

Quoted 5 lines

When you do a /sys/hypervisor/ interface, put everything into a subdirectory under /sys/hypervisor with the name of your hypervisor, to avoid naming conflicts, e.g.

/sys/hypervisor/tilera-hv/board/board_serial

I don't see an easy way to put a directory in /sys/hypervisor. It seems complex to create a kobject and a suitable class, etc., just for a subdirectory. Or is there something simple I'm missing? I'll keep looking.

I also suspect just "tile" is an adequate subdirectory name here in the context of /sys/hypervisor, e.g. /sys/hypervisor/tile/version.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/virtualization

#58 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

In reply to Arnd Bergmann

(Resending with no HTML for LKML.)

Quoted 16 lines · Arnd Bergmann

Any chance you can still restructure the information? I would recommend making it a first-class procfs member, since the data is really per-task.

You can add a conditional entry to tgid_base_stuff[] in fs/proc/base.c to make it show up for each pid, and then just have the per-task information in there to do the lookup the other way round:

# cat /proc/484/hardwall
2x2 1,1 @2,1
# cat /proc/479/hardwall
2x2 1,1 @1,1
Another problem with the existing interface is that it doesn't currently
support PID name spaces. That could of course be retrofitted, but having
the data split by pid directory would make it work implicitly.
Quoted 3 lines

Another approach would be to have a /proc/hardwall/ directory with one entry per hardwall instance, and symlinks from /proc/<pid>/hardwall to the respective file.

I went ahead and implemented this, and will send out a v2 patch shortly. I added the "hardwall" entry to both the tgid_base (since everything is reflected there) but also to the tid_base_stuff[], since it can be different (in principle) for different threads.

I played around with using a symlink, but the bottom line seems to be that if I make it a symlink (via a SYM() macro in the table) it always has to exist -- so what does it point to when there's no hardwall activated? I tried making it point to /dev/null, but that just seemed silly. In the end I made /proc/PID/hardwall a file, either empty, or else containing the hardwall id.

The actual hardwalls are then in /proc/tile/hardwall/NN, where NN is the hardwall id. I wrote a very simple hardwall id allocate/free pair; the pid allocator seemed too tied to task_structs. We only need at most NR_CPUS hardwall ids, so it's pretty simple to just use a cpumask to hold the set of allocated hardwall IDs.

The contents of the hardwall ID file are then just a cpulist of the cpus covered by the hardwall, rather than introducing a new convention (as quoted above, e.g. "2x2 1,1"). Individual tasks that are in the hardwall can be found by reading the "hardwall" files, and we can learn where they are bound in the hardwall by reading the "stat" file as is normal for learning process affinity.

Quoted 5 lines

When you do a /sys/hypervisor/ interface, put everything into a subdirectory under /sys/hypervisor with the name of your hypervisor, to avoid naming conflicts, e.g.

/sys/hypervisor/tilera-hv/board/board_serial

I don't see an easy way to put a directory in /sys/hypervisor. It seems complex to create a kobject and a suitable class, etc., just for a subdirectory. Or is there something simple I'm missing? I'll keep looking.

I also suspect just "tile" is an adequate subdirectory name here in the context of /sys/hypervisor, e.g. /sys/hypervisor/tile/version.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#59 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

In reply to Arnd Bergmann

(Resending with no HTML for LKML.)

Quoted 16 lines · Arnd Bergmann

Any chance you can still restructure the information? I would recommend making it a first-class procfs member, since the data is really per-task.

You can add a conditional entry to tgid_base_stuff[] in fs/proc/base.c to make it show up for each pid, and then just have the per-task information in there to do the lookup the other way round:

# cat /proc/484/hardwall
2x2 1,1 @2,1
# cat /proc/479/hardwall
2x2 1,1 @1,1
Another problem with the existing interface is that it doesn't currently
support PID name spaces. That could of course be retrofitted, but having
the data split by pid directory would make it work implicitly.
Quoted 3 lines

Another approach would be to have a /proc/hardwall/ directory with one entry per hardwall instance, and symlinks from /proc/<pid>/hardwall to the respective file.

I went ahead and implemented this, and will send out a v2 patch shortly. I added the "hardwall" entry to both the tgid_base (since everything is reflected there) but also to the tid_base_stuff[], since it can be different (in principle) for different threads.

I played around with using a symlink, but the bottom line seems to be that if I make it a symlink (via a SYM() macro in the table) it always has to exist -- so what does it point to when there's no hardwall activated? I tried making it point to /dev/null, but that just seemed silly. In the end I made /proc/PID/hardwall a file, either empty, or else containing the hardwall id.

The actual hardwalls are then in /proc/tile/hardwall/NN, where NN is the hardwall id. I wrote a very simple hardwall id allocate/free pair; the pid allocator seemed too tied to task_structs. We only need at most NR_CPUS hardwall ids, so it's pretty simple to just use a cpumask to hold the set of allocated hardwall IDs.

The contents of the hardwall ID file are then just a cpulist of the cpus covered by the hardwall, rather than introducing a new convention (as quoted above, e.g. "2x2 1,1"). Individual tasks that are in the hardwall can be found by reading the "hardwall" files, and we can learn where they are bound in the hardwall by reading the "stat" file as is normal for learning process affinity.

Quoted 5 lines

When you do a /sys/hypervisor/ interface, put everything into a subdirectory under /sys/hypervisor with the name of your hypervisor, to avoid naming conflicts, e.g.

/sys/hypervisor/tilera-hv/board/board_serial

I don't see an easy way to put a directory in /sys/hypervisor. It seems complex to create a kobject and a suitable class, etc., just for a subdirectory. Or is there something simple I'm missing? I'll keep looking.

I also suspect just "tile" is an adequate subdirectory name here in the context of /sys/hypervisor, e.g. /sys/hypervisor/tile/version.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
maintainer
#60 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

Quoted 19 lines · On Wednesday 25 May 2011 21:18:05 Chris Metcalf wrote:

(Resending with no HTML for LKML.)

Quoted 16 lines · Arnd Bergmann

Any chance you can still restructure the information? I would recommend making it a first-class procfs member, since the data is really per-task.

You can add a conditional entry to tgid_base_stuff[] in fs/proc/base.c to make it show up for each pid, and then just have the per-task information in there to do the lookup the other way round:

# cat /proc/484/hardwall
2x2 1,1 @2,1
# cat /proc/479/hardwall
2x2 1,1 @1,1
Another problem with the existing interface is that it doesn't currently
support PID name spaces. That could of course be retrofitted, but having
the data split by pid directory would make it work implicitly.
Quoted 8 lines
Quoted 3 lines

Another approach would be to have a /proc/hardwall/ directory with one entry per hardwall instance, and symlinks from /proc/<pid>/hardwall to the respective file.

I went ahead and implemented this, and will send out a v2 patch shortly. I added the "hardwall" entry to both the tgid_base (since everything is reflected there) but also to the tid_base_stuff[], since it can be different (in principle) for different threads.

Ok, sounds good.

Quoted 6 lines

I played around with using a symlink, but the bottom line seems to be that if I make it a symlink (via a SYM() macro in the table) it always has to exist -- so what does it point to when there's no hardwall activated? I tried making it point to /dev/null, but that just seemed silly. In the end I made /proc/PID/hardwall a file, either empty, or else containing the hardwall id.

ok. I suppose you could make a non-hardwall file that you can link to, but an empty file also sounds ok.

Quoted 5 lines

The actual hardwalls are then in /proc/tile/hardwall/NN, where NN is the hardwall id. I wrote a very simple hardwall id allocate/free pair; the pid allocator seemed too tied to task_structs. We only need at most NR_CPUS hardwall ids, so it's pretty simple to just use a cpumask to hold the set of allocated hardwall IDs.

ok.

Quoted 6 lines

The contents of the hardwall ID file are then just a cpulist of the cpus covered by the hardwall, rather than introducing a new convention (as quoted above, e.g. "2x2 1,1"). Individual tasks that are in the hardwall can be found by reading the "hardwall" files, and we can learn where they are bound in the hardwall by reading the "stat" file as is normal for learning process affinity.

Be careful with listing PID values in the hardwall files, as the PIDs may not be unique or visible if you combine this with PID name spaces. I guess the right solution would be to only list the tasks that are present in the name space of the thread reading the file.

Quoted 4 lines
Quoted 4 lines

When you do a /sys/hypervisor/ interface, put everything into a subdirectory under /sys/hypervisor with the name of your hypervisor, to avoid naming conflicts, e.g.

Quoted 8 lines
Quoted 1 line

/sys/hypervisor/tilera-hv/board/board_serial

I don't see an easy way to put a directory in /sys/hypervisor. It seems complex to create a kobject and a suitable class, etc., just for a subdirectory. Or is there something simple I'm missing? I'll keep looking.

I also suspect just "tile" is an adequate subdirectory name here in the context of /sys/hypervisor, e.g. /sys/hypervisor/tile/version.

I just checked for other users. The only one I could find was drivers/xen/sys-hypervisor.c, and it also doesn't use a subdirectory to identify that hypervisor. It's probably more consistent if you also don't do it then.

You can create a directory with multiple files using sysfs_create_group() as the xen code does, but not nested directories.

Arnd

maintainer
#61 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

In reply to Chris Metcalf
Quoted 19 lines · On Wednesday 25 May 2011 21:18:05 Chris Metcalf wrote:

(Resending with no HTML for LKML.)

Quoted 16 lines · Arnd Bergmann

Any chance you can still restructure the information? I would recommend making it a first-class procfs member, since the data is really per-task.

You can add a conditional entry to tgid_base_stuff[] in fs/proc/base.c to make it show up for each pid, and then just have the per-task information in there to do the lookup the other way round:

# cat /proc/484/hardwall
2x2 1,1 @2,1
# cat /proc/479/hardwall
2x2 1,1 @1,1
Another problem with the existing interface is that it doesn't currently
support PID name spaces. That could of course be retrofitted, but having
the data split by pid directory would make it work implicitly.
Quoted 8 lines
Quoted 3 lines

Another approach would be to have a /proc/hardwall/ directory with one entry per hardwall instance, and symlinks from /proc/<pid>/hardwall to the respective file.

I went ahead and implemented this, and will send out a v2 patch shortly. I added the "hardwall" entry to both the tgid_base (since everything is reflected there) but also to the tid_base_stuff[], since it can be different (in principle) for different threads.

Ok, sounds good.

Quoted 6 lines

I played around with using a symlink, but the bottom line seems to be that if I make it a symlink (via a SYM() macro in the table) it always has to exist -- so what does it point to when there's no hardwall activated? I tried making it point to /dev/null, but that just seemed silly. In the end I made /proc/PID/hardwall a file, either empty, or else containing the hardwall id.

ok. I suppose you could make a non-hardwall file that you can link to, but an empty file also sounds ok.

Quoted 5 lines

The actual hardwalls are then in /proc/tile/hardwall/NN, where NN is the hardwall id. I wrote a very simple hardwall id allocate/free pair; the pid allocator seemed too tied to task_structs. We only need at most NR_CPUS hardwall ids, so it's pretty simple to just use a cpumask to hold the set of allocated hardwall IDs.

ok.

Quoted 6 lines

The contents of the hardwall ID file are then just a cpulist of the cpus covered by the hardwall, rather than introducing a new convention (as quoted above, e.g. "2x2 1,1"). Individual tasks that are in the hardwall can be found by reading the "hardwall" files, and we can learn where they are bound in the hardwall by reading the "stat" file as is normal for learning process affinity.

Be careful with listing PID values in the hardwall files, as the PIDs may not be unique or visible if you combine this with PID name spaces. I guess the right solution would be to only list the tasks that are present in the name space of the thread reading the file.

Quoted 4 lines
Quoted 4 lines

When you do a /sys/hypervisor/ interface, put everything into a subdirectory under /sys/hypervisor with the name of your hypervisor, to avoid naming conflicts, e.g.

Quoted 8 lines
Quoted 1 line

/sys/hypervisor/tilera-hv/board/board_serial

I don't see an easy way to put a directory in /sys/hypervisor. It seems complex to create a kobject and a suitable class, etc., just for a subdirectory. Or is there something simple I'm missing? I'll keep looking.

I also suspect just "tile" is an adequate subdirectory name here in the context of /sys/hypervisor, e.g. /sys/hypervisor/tile/version.

I just checked for other users. The only one I could find was drivers/xen/sys-hypervisor.c, and it also doesn't use a subdirectory to identify that hypervisor. It's probably more consistent if you also don't do it then.

You can create a directory with multiple files using sysfs_create_group() as the xen code does, but not nested directories.

Arnd

#62 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

Quoted 11 lines · Arnd Bergmann
Quoted 6 lines · On Wednesday 25 May 2011 21:18:05 Chris Metcalf wrote:

The contents of the hardwall ID file are then just a cpulist of the cpus covered by the hardwall, rather than introducing a new convention (as quoted above, e.g. "2x2 1,1"). Individual tasks that are in the hardwall can be found by reading the "hardwall" files, and we can learn where they are bound in the hardwall by reading the "stat" file as is normal for learning process affinity.

Be careful with listing PID values in the hardwall files, as the PIDs may not be unique or visible if you combine this with PID name spaces. I guess the right solution would be to only list the tasks that are present in the name space of the thread reading the file.

Sorry not to be clearer -- I am no longer listing any PID values in the hardwall files, for that exact reason. You have to look at /proc/*/hardwall (or /proc/*/tasks/*/hardwall) to find the files that are in a particular hardwall. This pattern is not one that's normally directly useful, though, so I'm happy leaving it to userspace if it's desired.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

When you do a /sys/hypervisor/ interface, put everything into a subdirectory under /sys/hypervisor with the name of your hypervisor, to avoid naming conflicts, e.g.

Quoted 8 lines
Quoted 1 line
Quoted 1 line

/sys/hypervisor/tilera-hv/board/board_serial

I just checked for other users. The only one I could find was drivers/xen/sys-hypervisor.c, and it also doesn't use a subdirectory to identify that hypervisor. It's probably more consistent if you also don't do it then.

You can create a directory with multiple files using sysfs_create_group() as the xen code does, but not nested directories.

I'll look into sysfs_create_group(), and then send a revised patch with all the /proc and /sys changes. Thanks!

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#63 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

In reply to Arnd Bergmann
Quoted 11 lines · Arnd Bergmann
Quoted 6 lines · On Wednesday 25 May 2011 21:18:05 Chris Metcalf wrote:

The contents of the hardwall ID file are then just a cpulist of the cpus covered by the hardwall, rather than introducing a new convention (as quoted above, e.g. "2x2 1,1"). Individual tasks that are in the hardwall can be found by reading the "hardwall" files, and we can learn where they are bound in the hardwall by reading the "stat" file as is normal for learning process affinity.

Be careful with listing PID values in the hardwall files, as the PIDs may not be unique or visible if you combine this with PID name spaces. I guess the right solution would be to only list the tasks that are present in the name space of the thread reading the file.

Sorry not to be clearer -- I am no longer listing any PID values in the hardwall files, for that exact reason. You have to look at /proc/*/hardwall (or /proc/*/tasks/*/hardwall) to find the files that are in a particular hardwall. This pattern is not one that's normally directly useful, though, so I'm happy leaving it to userspace if it's desired.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

When you do a /sys/hypervisor/ interface, put everything into a subdirectory under /sys/hypervisor with the name of your hypervisor, to avoid naming conflicts, e.g.

Quoted 8 lines
Quoted 1 line
Quoted 1 line

/sys/hypervisor/tilera-hv/board/board_serial

I just checked for other users. The only one I could find was drivers/xen/sys-hypervisor.c, and it also doesn't use a subdirectory to identify that hypervisor. It's probably more consistent if you also don't do it then.

You can create a directory with multiple files using sysfs_create_group() as the xen code does, but not nested directories.

I'll look into sysfs_create_group(), and then send a revised patch with all the /proc and /sys changes. Thanks!

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
maintainer
#64 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

Quoted 13 lines · On Wednesday 25 May 2011 22:31:37 Chris Metcalf wrote:
Quoted 11 lines · Arnd Bergmann
Quoted 6 lines · On Wednesday 25 May 2011 21:18:05 Chris Metcalf wrote:

The contents of the hardwall ID file are then just a cpulist of the cpus covered by the hardwall, rather than introducing a new convention (as quoted above, e.g. "2x2 1,1"). Individual tasks that are in the hardwall can be found by reading the "hardwall" files, and we can learn where they are bound in the hardwall by reading the "stat" file as is normal for learning process affinity.

Be careful with listing PID values in the hardwall files, as the PIDs may not be unique or visible if you combine this with PID name spaces. I guess the right solution would be to only list the tasks that are present in the name space of the thread reading the file.

Quoted 5 lines

Sorry not to be clearer -- I am no longer listing any PID values in the hardwall files, for that exact reason. You have to look at /proc/*/hardwall (or /proc/*/tasks/*/hardwall) to find the files that are in a particular hardwall. This pattern is not one that's normally directly useful, though, so I'm happy leaving it to userspace if it's desired.

Ok, thanks for the clarification.

Arnd

maintainer
#65 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

In reply to Chris Metcalf
Quoted 13 lines · On Wednesday 25 May 2011 22:31:37 Chris Metcalf wrote:
Quoted 11 lines · Arnd Bergmann
Quoted 6 lines · On Wednesday 25 May 2011 21:18:05 Chris Metcalf wrote:

The contents of the hardwall ID file are then just a cpulist of the cpus covered by the hardwall, rather than introducing a new convention (as quoted above, e.g. "2x2 1,1"). Individual tasks that are in the hardwall can be found by reading the "hardwall" files, and we can learn where they are bound in the hardwall by reading the "stat" file as is normal for learning process affinity.

Be careful with listing PID values in the hardwall files, as the PIDs may not be unique or visible if you combine this with PID name spaces. I guess the right solution would be to only list the tasks that are present in the name space of the thread reading the file.

Quoted 5 lines

Sorry not to be clearer -- I am no longer listing any PID values in the hardwall files, for that exact reason. You have to look at /proc/*/hardwall (or /proc/*/tasks/*/hardwall) to find the files that are in a particular hardwall. This pattern is not one that's normally directly useful, though, so I'm happy leaving it to userspace if it's desired.

Ok, thanks for the clarification.

Arnd

maintainer
#66 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

In reply to Arnd Bergmann
Quoted 11 lines · Arnd Bergmann
Quoted 10 lines
# cat /proc/tile/board
board_part: 402-00002-05
board_serial: NBS-5002-00012
chip_serial: P62338.01.110
chip_revision: A0
board_revision: 2.2
board_description: Tilera TILExpressPro-64, TILEPro64 processor (866 MHz-capable), 1 10GbE, 6 1GbE
# cat /proc/tile/switch
control: mdio gbe/0
Quoted 4 lines

I think it's ok to have it below /sys/hypervisor, because the information is provided through a hypervisor ABI, even though it describes something else. This is more like /sys/firmware, but the boundaries between that and /sys/hypervisor are not clearly defined when running virtualized anyway.

A minor point that I meant to bring up but had not gotten to:

When you do a /sys/hypervisor/ interface, put everything into a subdirectory under /sys/hypervisor with the name of your hypervisor, to avoid naming conflicts, e.g.

/sys/hypervisor/tilera-hv/board/board_serial

Arnd

maintainer
#67 lore raw

Re: [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute

In reply to Arnd Bergmann
Quoted 11 lines · Arnd Bergmann
Quoted 10 lines
# cat /proc/tile/board
board_part: 402-00002-05
board_serial: NBS-5002-00012
chip_serial: P62338.01.110
chip_revision: A0
board_revision: 2.2
board_description: Tilera TILExpressPro-64, TILEPro64 processor (866 MHz-capable), 1 10GbE, 6 1GbE
# cat /proc/tile/switch
control: mdio gbe/0
Quoted 4 lines

I think it's ok to have it below /sys/hypervisor, because the information is provided through a hypervisor ABI, even though it describes something else. This is more like /sys/firmware, but the boundaries between that and /sys/hypervisor are not clearly defined when running virtualized anyway.

A minor point that I meant to bring up but had not gotten to:

When you do a /sys/hypervisor/ interface, put everything into a subdirectory under /sys/hypervisor with the name of your hypervisor, to avoid naming conflicts, e.g.

/sys/hypervisor/tilera-hv/board/board_serial

Arnd

#68 lore raw

PATCH v2 1/1 arch/tile: more /proc and /sys file support

In reply to Chris Metcalf

This change introduces a few of the less controversial /proc and /proc/sys interfaces for tile, along with sysfs attributes for various things that were originally proposed as /proc/tile files. It also adjusts the "hardwall" proc API.

Arnd Bergmann reviewed the initial arch/tile submission, which included a complete set of all the /proc/tile and /proc/sys/tile knobs that we had added in a somewhat ad hoc way during initial development, and provided feedback on where most of them should go.

One knob turned out to be similar enough to the existing /proc/sys/debug/exception-trace that it was re-implemented to use that model instead.

Another knob was /proc/tile/grid, which reported the "grid" dimensions of a tile chip (e.g. 8x8 processors = 64-core chip). Arnd suggested looking at sysfs for that, so this change moves that information to a pair of sysfs attributes (chip_width and chip_height) in the /sys/devices/system/cpu directory. We also put the "chip_serial" and "chip_revision" information from our old /proc/tile/board file as attributes in /sys/devices/system/cpu.

Other information collected via hypervisor APIs is now placed in /sys/hypervisor. We create a /sys/hypervisor/type file (holding the constant string "tilera") to be parallel with the Xen use of /sys/hypervisor/type holding "xen". We create three top-level files, "version" (the hypervisor's own version), "config_version" (the version of the configuration file), and "hvconfig" (the contents of the configuration file). The remaining information from our old /proc/tile/board and /proc/tile/switch files becomes an attribute group appearing under /sys/hypervisor/board/.

Finally, after some feedback from Arnd Berghamm for the previous version of this patch, the /proc/tile/hardwall file is split up into two conceptual parts. First, a directory /proc/tile/hardwall/ which contains one file per active hardwall, each file named after the hardwall's ID and holding a cpulist that says which cpus are enclosed by the hardwall. Second, a /proc/PID file "hardwall" that is either empty (for non-hardwall-using processes) or contains the hardwall ID.

Finally, this change pushes the /proc/sys/tile/unaligned_fixup/ directory, with knobs controlling the kernel code for handling the fixup of unaligned exceptions.

---
 arch/tile/Kconfig                |    1 +
 arch/tile/include/asm/hardwall.h |   15 +++-
 arch/tile/kernel/Makefile        |    2 +-
 arch/tile/kernel/hardwall.c      |   90 ++++++++++++++-----
 arch/tile/kernel/proc.c          |   73 +++++++++++++++
 arch/tile/kernel/sysfs.c         |  185 ++++++++++++++++++++++++++++++++++++++
 fs/proc/base.c                   |    9 ++
 7 files changed, 347 insertions(+), 28 deletions(-)
 create mode 100644 arch/tile/kernel/sysfs.c
arch/tile/Kconfig +1 -0
index 635e1bf..3f7d63c 100644
@@ -12,6 +12,7 @@ config TILE
 	select GENERIC_IRQ_PROBE
 	select GENERIC_PENDING_IRQ if SMP
 	select GENERIC_IRQ_SHOW
+	select SYS_HYPERVISOR
 
 # FIXME: investigate whether we need/want these options.
 #	select HAVE_IOREMAP_PROT
arch/tile/include/asm/hardwall.h +12 -3
index 0bed3ec..2ac4228 100644
@@ -40,6 +40,10 @@
 #define HARDWALL_DEACTIVATE \
  _IO(HARDWALL_IOCTL_BASE, _HARDWALL_DEACTIVATE)
 
+#define _HARDWALL_GET_ID 4
+#define HARDWALL_GET_ID \
+ _IO(HARDWALL_IOCTL_BASE, _HARDWALL_GET_ID)
+
 #ifndef __KERNEL__
 
 /* This is the canonical name expected by userspace. */
@@ -47,9 +51,14 @@
 
 #else
 
-/* Hook for /proc/tile/hardwall. */
-struct seq_file;
-int proc_tile_hardwall_show(struct seq_file *sf, void *v);
+/* /proc hooks for hardwall. */
+struct proc_dir_entry;
+#ifdef CONFIG_HARDWALL
+void proc_tile_hardwall_init(struct proc_dir_entry *root);
+int proc_pid_hardwall(struct task_struct *task, char *buffer);
+#else
+static inline void proc_tile_hardwall_init(struct proc_dir_entry *root) {}
+#endif
 
 #endif
 
arch/tile/kernel/Makefile +1 -1
index b4c8e8e..b4dbc05 100644
@@ -5,7 +5,7 @@
 extra-y := vmlinux.lds head_$(BITS).o
 obj-y := backtrace.o entry.o init_task.o irq.o messaging.o \
 	pci-dma.o proc.o process.o ptrace.o reboot.o \
-	setup.o signal.o single_step.o stack.o sys.o time.o traps.o \
+	setup.o signal.o single_step.o stack.o sys.o sysfs.o time.o traps.o \
 	intvec_$(BITS).o regs_$(BITS).o tile-desc_$(BITS).o
 
 obj-$(CONFIG_HARDWALL)		+= hardwall.o
arch/tile/kernel/hardwall.c +66 -24

141 lines not on this page · raw message

arch/tile/kernel/proc.c +73 -0

82 lines not on this page · raw message

arch/tile/kernel/sysfs.c new file +185 -0

185 lines not on this page · raw message

fs/proc/base.c +9 -0
index dfa5327..3ad615f 100644
@@ -83,6 +83,9 @@
 #include <linux/pid_namespace.h>
 #include <linux/fs_struct.h>
 #include <linux/slab.h>
+#ifdef CONFIG_HARDWALL
+#include <asm/hardwall.h>
+#endif
 #include "internal.h"
 
 /* NOTE:
@@ -2894,6 +2897,9 @@ static const struct pid_entry tgid_base_stuff[] = {
 #ifdef CONFIG_TASK_IO_ACCOUNTING
 	INF("io",	S_IRUGO, proc_tgid_io_accounting),
 #endif
+#ifdef CONFIG_HARDWALL
+	INF("hardwall",   S_IRUGO, proc_pid_hardwall),
+#endif
 };
 
 static int proc_tgid_base_readdir(struct file * filp,
@@ -3232,6 +3238,9 @@ static const struct pid_entry tid_base_stuff[] = {
 #ifdef CONFIG_TASK_IO_ACCOUNTING
 	INF("io",	S_IRUGO, proc_tid_io_accounting),
 #endif
+#ifdef CONFIG_HARDWALL
+	INF("hardwall",   S_IRUGO, proc_pid_hardwall),
+#endif
 };
 
 static int proc_tid_base_readdir(struct file * filp,
Signature · 1 line
1.6.5.2
#69 lore raw

PATCH v2 1/1 arch/tile: more /proc and /sys file support

In reply to Chris Metcalf

This change introduces a few of the less controversial /proc and /proc/sys interfaces for tile, along with sysfs attributes for various things that were originally proposed as /proc/tile files. It also adjusts the "hardwall" proc API.

Arnd Bergmann reviewed the initial arch/tile submission, which included a complete set of all the /proc/tile and /proc/sys/tile knobs that we had added in a somewhat ad hoc way during initial development, and provided feedback on where most of them should go.

One knob turned out to be similar enough to the existing /proc/sys/debug/exception-trace that it was re-implemented to use that model instead.

Another knob was /proc/tile/grid, which reported the "grid" dimensions of a tile chip (e.g. 8x8 processors = 64-core chip). Arnd suggested looking at sysfs for that, so this change moves that information to a pair of sysfs attributes (chip_width and chip_height) in the /sys/devices/system/cpu directory. We also put the "chip_serial" and "chip_revision" information from our old /proc/tile/board file as attributes in /sys/devices/system/cpu.

Other information collected via hypervisor APIs is now placed in /sys/hypervisor. We create a /sys/hypervisor/type file (holding the constant string "tilera") to be parallel with the Xen use of /sys/hypervisor/type holding "xen". We create three top-level files, "version" (the hypervisor's own version), "config_version" (the version of the configuration file), and "hvconfig" (the contents of the configuration file). The remaining information from our old /proc/tile/board and /proc/tile/switch files becomes an attribute group appearing under /sys/hypervisor/board/.

Finally, after some feedback from Arnd Berghamm for the previous version of this patch, the /proc/tile/hardwall file is split up into two conceptual parts. First, a directory /proc/tile/hardwall/ which contains one file per active hardwall, each file named after the hardwall's ID and holding a cpulist that says which cpus are enclosed by the hardwall. Second, a /proc/PID file "hardwall" that is either empty (for non-hardwall-using processes) or contains the hardwall ID.

Finally, this change pushes the /proc/sys/tile/unaligned_fixup/ directory, with knobs controlling the kernel code for handling the fixup of unaligned exceptions.

---
 arch/tile/Kconfig                |    1 +
 arch/tile/include/asm/hardwall.h |   15 +++-
 arch/tile/kernel/Makefile        |    2 +-
 arch/tile/kernel/hardwall.c      |   90 ++++++++++++++-----
 arch/tile/kernel/proc.c          |   73 +++++++++++++++
 arch/tile/kernel/sysfs.c         |  185 ++++++++++++++++++++++++++++++++++++++
 fs/proc/base.c                   |    9 ++
 7 files changed, 347 insertions(+), 28 deletions(-)
 create mode 100644 arch/tile/kernel/sysfs.c
arch/tile/Kconfig +1 -0
index 635e1bf..3f7d63c 100644
@@ -12,6 +12,7 @@ config TILE
 	select GENERIC_IRQ_PROBE
 	select GENERIC_PENDING_IRQ if SMP
 	select GENERIC_IRQ_SHOW
+	select SYS_HYPERVISOR
 
 # FIXME: investigate whether we need/want these options.
 #	select HAVE_IOREMAP_PROT
arch/tile/include/asm/hardwall.h +12 -3
index 0bed3ec..2ac4228 100644
@@ -40,6 +40,10 @@
 #define HARDWALL_DEACTIVATE \
  _IO(HARDWALL_IOCTL_BASE, _HARDWALL_DEACTIVATE)
 
+#define _HARDWALL_GET_ID 4
+#define HARDWALL_GET_ID \
+ _IO(HARDWALL_IOCTL_BASE, _HARDWALL_GET_ID)
+
 #ifndef __KERNEL__
 
 /* This is the canonical name expected by userspace. */
@@ -47,9 +51,14 @@
 
 #else
 
-/* Hook for /proc/tile/hardwall. */
-struct seq_file;
-int proc_tile_hardwall_show(struct seq_file *sf, void *v);
+/* /proc hooks for hardwall. */
+struct proc_dir_entry;
+#ifdef CONFIG_HARDWALL
+void proc_tile_hardwall_init(struct proc_dir_entry *root);
+int proc_pid_hardwall(struct task_struct *task, char *buffer);
+#else
+static inline void proc_tile_hardwall_init(struct proc_dir_entry *root) {}
+#endif
 
 #endif
 
arch/tile/kernel/Makefile +1 -1
index b4c8e8e..b4dbc05 100644
@@ -5,7 +5,7 @@
 extra-y := vmlinux.lds head_$(BITS).o
 obj-y := backtrace.o entry.o init_task.o irq.o messaging.o \
 	pci-dma.o proc.o process.o ptrace.o reboot.o \
-	setup.o signal.o single_step.o stack.o sys.o time.o traps.o \
+	setup.o signal.o single_step.o stack.o sys.o sysfs.o time.o traps.o \
 	intvec_$(BITS).o regs_$(BITS).o tile-desc_$(BITS).o
 
 obj-$(CONFIG_HARDWALL)		+= hardwall.o
arch/tile/kernel/hardwall.c +66 -24

141 lines not on this page · raw message

arch/tile/kernel/proc.c +73 -0

82 lines not on this page · raw message

arch/tile/kernel/sysfs.c new file +185 -0

185 lines not on this page · raw message

fs/proc/base.c +9 -0
index dfa5327..3ad615f 100644
@@ -83,6 +83,9 @@
 #include <linux/pid_namespace.h>
 #include <linux/fs_struct.h>
 #include <linux/slab.h>
+#ifdef CONFIG_HARDWALL
+#include <asm/hardwall.h>
+#endif
 #include "internal.h"
 
 /* NOTE:
@@ -2894,6 +2897,9 @@ static const struct pid_entry tgid_base_stuff[] = {
 #ifdef CONFIG_TASK_IO_ACCOUNTING
 	INF("io",	S_IRUGO, proc_tgid_io_accounting),
 #endif
+#ifdef CONFIG_HARDWALL
+	INF("hardwall",   S_IRUGO, proc_pid_hardwall),
+#endif
 };
 
 static int proc_tgid_base_readdir(struct file * filp,
@@ -3232,6 +3238,9 @@ static const struct pid_entry tid_base_stuff[] = {
 #ifdef CONFIG_TASK_IO_ACCOUNTING
 	INF("io",	S_IRUGO, proc_tid_io_accounting),
 #endif
+#ifdef CONFIG_HARDWALL
+	INF("hardwall",   S_IRUGO, proc_pid_hardwall),
+#endif
 };
 
 static int proc_tid_base_readdir(struct file * filp,
Signature · 1 line
1.6.5.2
maintainer Reviewed-by on v2 1/1
#70 lore raw

Re: [PATCH v2] arch/tile: more /proc and /sys file support

Quoted 4 lines · Chris Metcalf

This change introduces a few of the less controversial /proc and /proc/sys interfaces for tile, along with sysfs attributes for various things that were originally proposed as /proc/tile files. It also adjusts the "hardwall" proc API.

Looks good to me now, except

Quoted 1 line

Finally, after some feedback from Arnd Berghamm for the previous

typo ^^^^

maintainer Reviewed-by on v2 1/1
#71 lore raw

Re: [PATCH v2] arch/tile: more /proc and /sys file support

In reply to Chris Metcalf
Quoted 4 lines · Chris Metcalf

This change introduces a few of the less controversial /proc and /proc/sys interfaces for tile, along with sysfs attributes for various things that were originally proposed as /proc/tile files. It also adjusts the "hardwall" proc API.

Looks good to me now, except

Quoted 1 line

Finally, after some feedback from Arnd Berghamm for the previous

typo ^^^^

#72 lore raw

PATCH 1/1 arch/tile: support signal "exception-trace" hook

In reply to Arnd Bergmann

This change adds support for /proc/sys/debug/exception-trace to tile. Like x86 and sparc, by default it is set to "1", generating a one-line printk whenever a user process crashes. By setting it to "2", we get a much more complete userspace diagnostic at crash time, including a user-space backtrace, register dump, and memory dump around the address of the crash.

Some vestiges of the Tilera-internal version of this support are removed with this patch (the show_crashinfo variable and the arch_coredump_signal function). We retain a "crashinfo" boot parameter which allows you to set the boot-time value of exception-trace.

---
Arnd Bergmann originally requested this (see parent email in thread) in code review of an early batch of arch/tile code.

 arch/tile/include/asm/processor.h |    7 --
 arch/tile/include/asm/signal.h    |    4 +
 arch/tile/kernel/compat_signal.c  |    4 +-
 arch/tile/kernel/signal.c         |  128 +++++++++++++++++++++++++++++++++++-
 arch/tile/kernel/single_step.c    |    4 +
 arch/tile/kernel/traps.c          |    1 +
 arch/tile/mm/fault.c              |   24 ++++---
 kernel/sysctl.c                   |    2 +-
 8 files changed, 151 insertions(+), 23 deletions(-)
arch/tile/include/asm/processor.h +0 -7
index d6b43dd..34c1e01 100644
@@ -257,10 +257,6 @@ static inline void cpu_relax(void)
 	barrier();
 }
 
-struct siginfo;
-extern void arch_coredump_signal(struct siginfo *, struct pt_regs *);
-#define arch_coredump_signal arch_coredump_signal
-
 /* Info on this processor (see fs/proc/cpuinfo.c) */
 struct seq_operations;
 extern const struct seq_operations cpuinfo_op;
@@ -271,9 +267,6 @@ extern char chip_model[64];
 /* Data on which physical memory controller corresponds to which NUMA node. */
 extern int node_controller[];
 
-/* Do we dump information to the console when a user application crashes? */
-extern int show_crashinfo;
-
 #if CHIP_HAS_CBOX_HOME_MAP()
 /* Does the heap allocator return hash-for-home pages by default? */
 extern int hash_default;
arch/tile/include/asm/signal.h +4 -0
index 81d92a4..1e1e616 100644
@@ -28,6 +28,10 @@ struct pt_regs;
 int restore_sigcontext(struct pt_regs *, struct sigcontext __user *);
 int setup_sigcontext(struct sigcontext __user *, struct pt_regs *);
 void do_signal(struct pt_regs *regs);
+void signal_fault(const char *type, struct pt_regs *,
+		  void __user *frame, int sig);
+void trace_unhandled_signal(const char *type, struct pt_regs *regs,
+			    unsigned long address, int signo);
 #endif
 
 #endif /* _ASM_TILE_SIGNAL_H */
arch/tile/kernel/compat_signal.c +2 -2
index dbb0dfc..a7869ad 100644
@@ -317,7 +317,7 @@ long compat_sys_rt_sigreturn(struct pt_regs *regs)
 	return 0;
 
 badframe:
-	force_sig(SIGSEGV, current);
+	signal_fault("bad sigreturn frame", regs, frame, 0);
 	return 0;
 }
 
@@ -431,6 +431,6 @@ int compat_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 	return 0;
 
 give_sigsegv:
-	force_sigsegv(sig, current);
+	signal_fault("bad setup frame", regs, frame, sig);
 	return -EFAULT;
 }
arch/tile/kernel/signal.c +124 -4

161 lines not on this page · raw message

arch/tile/kernel/single_step.c +4 -0
index 86df5a2..4032ca8 100644
@@ -186,6 +186,8 @@ static tile_bundle_bits rewrite_load_store_unaligned(
 			.si_code = SEGV_MAPERR,
 			.si_addr = addr
 		};
+		trace_unhandled_signal("segfault", regs,
+				       (unsigned long)addr, SIGSEGV);
 		force_sig_info(info.si_signo, &info, current);
 		return (tile_bundle_bits) 0;
 	}
@@ -196,6 +198,8 @@ static tile_bundle_bits rewrite_load_store_unaligned(
 			.si_code = BUS_ADRALN,
 			.si_addr = addr
 		};
+		trace_unhandled_signal("unaligned trap", regs,
+				       (unsigned long)addr, SIGBUS);
 		force_sig_info(info.si_signo, &info, current);
 		return (tile_bundle_bits) 0;
 	}
arch/tile/kernel/traps.c +1 -0
index 5474fc2..f9803df 100644
@@ -308,6 +308,7 @@ void __kprobes do_trap(struct pt_regs *regs, int fault_num,
 	info.si_addr = (void __user *)address;
 	if (signo == SIGILL)
 		info.si_trapno = fault_num;
+	trace_unhandled_signal("trap", regs, address, signo);
 	force_sig_info(signo, &info, current);
 }
 
arch/tile/mm/fault.c +15 -9
index 24ca54a..25b7b90 100644
@@ -43,8 +43,11 @@
 
 #include <arch/interrupts.h>
 
-static noinline void force_sig_info_fault(int si_signo, int si_code,
-	unsigned long address, int fault_num, struct task_struct *tsk)
+static noinline void force_sig_info_fault(const char *type, int si_signo,
+					  int si_code, unsigned long address,
+					  int fault_num,
+					  struct task_struct *tsk,
+					  struct pt_regs *regs)
 {
 	siginfo_t info;
 
@@ -59,6 +62,7 @@ static noinline void force_sig_info_fault(int si_signo, int si_code,
 	info.si_code = si_code;
 	info.si_addr = (void __user *)address;
 	info.si_trapno = fault_num;
+	trace_unhandled_signal(type, regs, address, si_signo);
 	force_sig_info(si_signo, &info, tsk);
 }
 
@@ -71,11 +75,12 @@ SYSCALL_DEFINE2(cmpxchg_badaddr, unsigned long, address,
 		struct pt_regs *, regs)
 {
 	if (address >= PAGE_OFFSET)
-		force_sig_info_fault(SIGSEGV, SEGV_MAPERR, address,
-				     INT_DTLB_MISS, current);
+		force_sig_info_fault("atomic segfault", SIGSEGV, SEGV_MAPERR,
+				     address, INT_DTLB_MISS, current, regs);
 	else
-		force_sig_info_fault(SIGBUS, BUS_ADRALN, address,
-				     INT_UNALIGN_DATA, current);
+		force_sig_info_fault("atomic alignment fault", SIGBUS,
+				     BUS_ADRALN, address,
+				     INT_UNALIGN_DATA, current, regs);
 
 	/*
 	 * Adjust pc to point at the actual instruction, which is unusual
@@ -471,8 +476,8 @@ bad_area_nosemaphore:
 		 */
 		local_irq_enable();
 
-		force_sig_info_fault(SIGSEGV, si_code, address,
-				     fault_num, tsk);
+		force_sig_info_fault("segfault", SIGSEGV, si_code, address,
+				     fault_num, tsk, regs);
 		return 0;
 	}
 
@@ -547,7 +552,8 @@ do_sigbus:
 	if (is_kernel_mode)
 		goto no_context;
 
-	force_sig_info_fault(SIGBUS, BUS_ADRERR, address, fault_num, tsk);
+	force_sig_info_fault("bus error", SIGBUS, BUS_ADRERR, address,
+			     fault_num, tsk, regs);
 	return 0;
 }
 
kernel/sysctl.c +1 -1
index c0bb324..aaec934 100644
@@ -1496,7 +1496,7 @@ static struct ctl_table fs_table[] = {
 
 static struct ctl_table debug_table[] = {
 #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
-    defined(CONFIG_S390)
+    defined(CONFIG_S390) || defined(CONFIG_TILE)
 	{
 		.procname	= "exception-trace",
 		.data		= &show_unhandled_signals,
Signature · 1 line
1.6.5.2
#73 lore raw

Re: [PATCH] arch/tile: support signal "exception-trace" hook

Resending with Andi Kleen's current email address ([email protected] was in the git log for the x86 version of show-unhandled-signals).

Quoted 370 lines · Chris Metcalf

This change adds support for /proc/sys/debug/exception-trace to tile. Like x86 and sparc, by default it is set to "1", generating a one-line printk whenever a user process crashes. By setting it to "2", we get a much more complete userspace diagnostic at crash time, including a user-space backtrace, register dump, and memory dump around the address of the crash.

Some vestiges of the Tilera-internal version of this support are removed with this patch (the show_crashinfo variable and the arch_coredump_signal function). We retain a "crashinfo" boot parameter which allows you to set the boot-time value of exception-trace.

---
Arnd Bergmann originally requested this (see parent email in thread) in code review of an early batch of arch/tile code.

 arch/tile/include/asm/processor.h |    7 --
 arch/tile/include/asm/signal.h    |    4 +
 arch/tile/kernel/compat_signal.c  |    4 +-
 arch/tile/kernel/signal.c         |  128 +++++++++++++++++++++++++++++++++++-
 arch/tile/kernel/single_step.c    |    4 +
 arch/tile/kernel/traps.c          |    1 +
 arch/tile/mm/fault.c              |   24 ++++---
 kernel/sysctl.c                   |    2 +-
 8 files changed, 151 insertions(+), 23 deletions(-)
arch/tile/include/asm/processor.h +0 -7
index d6b43dd..34c1e01 100644
@@ -257,10 +257,6 @@ static inline void cpu_relax(void)
 	barrier();
 }
 
-struct siginfo;
-extern void arch_coredump_signal(struct siginfo *, struct pt_regs *);
-#define arch_coredump_signal arch_coredump_signal
-
 /* Info on this processor (see fs/proc/cpuinfo.c) */
 struct seq_operations;
 extern const struct seq_operations cpuinfo_op;
@@ -271,9 +267,6 @@ extern char chip_model[64];
 /* Data on which physical memory controller corresponds to which NUMA node. */
 extern int node_controller[];
 
-/* Do we dump information to the console when a user application crashes? */
-extern int show_crashinfo;
-
 #if CHIP_HAS_CBOX_HOME_MAP()
 /* Does the heap allocator return hash-for-home pages by default? */
 extern int hash_default;
arch/tile/include/asm/signal.h +4 -0
index 81d92a4..1e1e616 100644
@@ -28,6 +28,10 @@ struct pt_regs;
 int restore_sigcontext(struct pt_regs *, struct sigcontext __user *);
 int setup_sigcontext(struct sigcontext __user *, struct pt_regs *);
 void do_signal(struct pt_regs *regs);
+void signal_fault(const char *type, struct pt_regs *,
+		  void __user *frame, int sig);
+void trace_unhandled_signal(const char *type, struct pt_regs *regs,
+			    unsigned long address, int signo);
 #endif
 
 #endif /* _ASM_TILE_SIGNAL_H */
arch/tile/kernel/compat_signal.c +2 -2
index dbb0dfc..a7869ad 100644
@@ -317,7 +317,7 @@ long compat_sys_rt_sigreturn(struct pt_regs *regs)
 	return 0;
 
 badframe:
-	force_sig(SIGSEGV, current);
+	signal_fault("bad sigreturn frame", regs, frame, 0);
 	return 0;
 }
 
@@ -431,6 +431,6 @@ int compat_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 	return 0;
 
 give_sigsegv:
-	force_sigsegv(sig, current);
+	signal_fault("bad setup frame", regs, frame, sig);
 	return -EFAULT;
 }
arch/tile/kernel/signal.c +124 -4
index 1260321..bedaf4e 100644
@@ -39,7 +39,6 @@
 
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 
-
 SYSCALL_DEFINE3(sigaltstack, const stack_t __user *, uss,
 		stack_t __user *, uoss, struct pt_regs *, regs)
 {
@@ -78,6 +77,13 @@ int restore_sigcontext(struct pt_regs *regs,
 	return err;
 }
 
+void signal_fault(const char *type, struct pt_regs *regs,
+		  void __user *frame, int sig)
+{
+	trace_unhandled_signal(type, regs, (unsigned long)frame, SIGSEGV);
+	force_sigsegv(sig, current);
+}
+
 /* The assembly shim for this function arranges to ignore the return value. */
 SYSCALL_DEFINE1(rt_sigreturn, struct pt_regs *, regs)
 {
@@ -105,7 +111,7 @@ SYSCALL_DEFINE1(rt_sigreturn, struct pt_regs *, regs)
 	return 0;
 
 badframe:
-	force_sig(SIGSEGV, current);
+	signal_fault("bad sigreturn frame", regs, frame, 0);
 	return 0;
 }
 
@@ -231,7 +237,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 	return 0;
 
 give_sigsegv:
-	force_sigsegv(sig, current);
+	signal_fault("bad setup frame", regs, frame, sig);
 	return -EFAULT;
 }
 
@@ -245,7 +251,6 @@ static int handle_signal(unsigned long sig, siginfo_t *info,
 {
 	int ret;
 
-
 	/* Are we from a system call? */
 	if (regs->faultnum == INT_SWINT_1) {
 		/* If so, check system call restarting.. */
@@ -363,3 +368,118 @@ done:
 	/* Avoid double syscall restart if there are nested signals. */
 	regs->faultnum = INT_SWINT_1_SIGRETURN;
 }
+
+int show_unhandled_signals = 1;
+
+static int __init crashinfo(char *str)
+{
+	unsigned long val;
+	const char *word;
+
+	if (*str == '\0')
+		val = 2;
+	else if (*str != '=' || strict_strtoul(++str, 0, &val) != 0)
+		return 0;
+	show_unhandled_signals = val;
+	switch (show_unhandled_signals) {
+	case 0:
+		word = "No";
+		break;
+	case 1:
+		word = "One-line";
+		break;
+	default:
+		word = "Detailed";
+		break;
+	}
+	pr_info("%s crash reports will be generated on the console\n", word);
+	return 1;
+}
+__setup("crashinfo", crashinfo);
+
+static void dump_mem(void __user *address)
+{
+	void __user *addr;
+	enum { region_size = 256, bytes_per_line = 16 };
+	int i, j, k;
+	int found_readable_mem = 0;
+
+	pr_err("\n");
+	if (!access_ok(VERIFY_READ, address, 1)) {
+		pr_err("Not dumping at address 0x%lx (kernel address)\n",
+		       (unsigned long)address);
+		return;
+	}
+
+	addr = (void __user *)
+		(((unsigned long)address & -bytes_per_line) - region_size/2);
+	if (addr > address)
+		addr = NULL;
+	for (i = 0; i < region_size;
+	     addr += bytes_per_line, i += bytes_per_line) {
+		unsigned char buf[bytes_per_line];
+		char line[100];
+		if (copy_from_user(buf, addr, bytes_per_line))
+			continue;
+		if (!found_readable_mem) {
+			pr_err("Dumping memory around address 0x%lx:\n",
+			       (unsigned long)address);
+			found_readable_mem = 1;
+		}
+		j = sprintf(line, REGFMT":", (unsigned long)addr);
+		for (k = 0; k < bytes_per_line; ++k)
+			j += sprintf(&line[j], " %02x", buf[k]);
+		pr_err("%s\n", line);
+	}
+	if (!found_readable_mem)
+		pr_err("No readable memory around address 0x%lx\n",
+		       (unsigned long)address);
+}
+
+void trace_unhandled_signal(const char *type, struct pt_regs *regs,
+			    unsigned long address, int sig)
+{
+	struct task_struct *tsk = current;
+
+	if (show_unhandled_signals == 0)
+		return;
+
+	/* If the signal is handled, don't show it here. */
+	if (!is_global_init(tsk)) {
+		void __user *handler =
+			tsk->sighand->action[sig-1].sa.sa_handler;
+		if (handler != SIG_IGN && handler != SIG_DFL)
+			return;
+	}
+
+	/* Rate-limit the one-line output, not the detailed output. */
+	if (show_unhandled_signals <= 1 && !printk_ratelimit())
+		return;
+
+	printk("%s%s[%d]: %s at %lx pc "REGFMT" signal %d",
+	       task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG,
+	       tsk->comm, task_pid_nr(tsk), type, address, regs->pc, sig);
+
+	print_vma_addr(KERN_CONT " in ", regs->pc);
+
+	printk(KERN_CONT "\n");
+
+	if (show_unhandled_signals > 1) {
+		switch (sig) {
+		case SIGILL:
+		case SIGFPE:
+		case SIGSEGV:
+		case SIGBUS:
+			pr_err("User crash: signal %d,"
+			       " trap %ld, address 0x%lx\n",
+			       sig, regs->faultnum, address);
+			show_regs(regs);
+			dump_mem((void __user *)address);
+			break;
+		default:
+			pr_err("User crash: signal %d, trap %ld\n",
+			       sig, regs->faultnum);
+			break;
+		}
+	}
+}
arch/tile/kernel/single_step.c +4 -0
index 86df5a2..4032ca8 100644
@@ -186,6 +186,8 @@ static tile_bundle_bits rewrite_load_store_unaligned(
 			.si_code = SEGV_MAPERR,
 			.si_addr = addr
 		};
+		trace_unhandled_signal("segfault", regs,
+				       (unsigned long)addr, SIGSEGV);
 		force_sig_info(info.si_signo, &info, current);
 		return (tile_bundle_bits) 0;
 	}
@@ -196,6 +198,8 @@ static tile_bundle_bits rewrite_load_store_unaligned(
 			.si_code = BUS_ADRALN,
 			.si_addr = addr
 		};
+		trace_unhandled_signal("unaligned trap", regs,
+				       (unsigned long)addr, SIGBUS);
 		force_sig_info(info.si_signo, &info, current);
 		return (tile_bundle_bits) 0;
 	}
arch/tile/kernel/traps.c +1 -0
index 5474fc2..f9803df 100644
@@ -308,6 +308,7 @@ void __kprobes do_trap(struct pt_regs *regs, int fault_num,
 	info.si_addr = (void __user *)address;
 	if (signo == SIGILL)
 		info.si_trapno = fault_num;
+	trace_unhandled_signal("trap", regs, address, signo);
 	force_sig_info(signo, &info, current);
 }
 
arch/tile/mm/fault.c +15 -9
index 24ca54a..25b7b90 100644
@@ -43,8 +43,11 @@
 
 #include <arch/interrupts.h>
 
-static noinline void force_sig_info_fault(int si_signo, int si_code,
-	unsigned long address, int fault_num, struct task_struct *tsk)
+static noinline void force_sig_info_fault(const char *type, int si_signo,
+					  int si_code, unsigned long address,
+					  int fault_num,
+					  struct task_struct *tsk,
+					  struct pt_regs *regs)
 {
 	siginfo_t info;
 
@@ -59,6 +62,7 @@ static noinline void force_sig_info_fault(int si_signo, int si_code,
 	info.si_code = si_code;
 	info.si_addr = (void __user *)address;
 	info.si_trapno = fault_num;
+	trace_unhandled_signal(type, regs, address, si_signo);
 	force_sig_info(si_signo, &info, tsk);
 }
 
@@ -71,11 +75,12 @@ SYSCALL_DEFINE2(cmpxchg_badaddr, unsigned long, address,
 		struct pt_regs *, regs)
 {
 	if (address >= PAGE_OFFSET)
-		force_sig_info_fault(SIGSEGV, SEGV_MAPERR, address,
-				     INT_DTLB_MISS, current);
+		force_sig_info_fault("atomic segfault", SIGSEGV, SEGV_MAPERR,
+				     address, INT_DTLB_MISS, current, regs);
 	else
-		force_sig_info_fault(SIGBUS, BUS_ADRALN, address,
-				     INT_UNALIGN_DATA, current);
+		force_sig_info_fault("atomic alignment fault", SIGBUS,
+				     BUS_ADRALN, address,
+				     INT_UNALIGN_DATA, current, regs);
 
 	/*
 	 * Adjust pc to point at the actual instruction, which is unusual
@@ -471,8 +476,8 @@ bad_area_nosemaphore:
 		 */
 		local_irq_enable();
 
-		force_sig_info_fault(SIGSEGV, si_code, address,
-				     fault_num, tsk);
+		force_sig_info_fault("segfault", SIGSEGV, si_code, address,
+				     fault_num, tsk, regs);
 		return 0;
 	}
 
@@ -547,7 +552,8 @@ do_sigbus:
 	if (is_kernel_mode)
 		goto no_context;
 
-	force_sig_info_fault(SIGBUS, BUS_ADRERR, address, fault_num, tsk);
+	force_sig_info_fault("bus error", SIGBUS, BUS_ADRERR, address,
+			     fault_num, tsk, regs);
 	return 0;
 }
 
kernel/sysctl.c +1 -1
index c0bb324..aaec934 100644
@@ -1496,7 +1496,7 @@ static struct ctl_table fs_table[] = {
 
 static struct ctl_table debug_table[] = {
 #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
-    defined(CONFIG_S390)
+    defined(CONFIG_S390) || defined(CONFIG_TILE)
 	{
 		.procname	= "exception-trace",
 		.data		= &show_unhandled_signals,
Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#74 lore raw
In reply to Chris Metcalf

Hi Chris.

Kernle code looked good from a quick browsing.

Please explain the need for all the different directories within include/ {arch, hv, netio}

I tried not to repeat comments from Arnd in the below.

arch/tile/Kconfig:
The TILE specific symbols looks like they use several different naming schemes. In some cases the company name (TILERA) is used and in some cases TILE is used. And both as prefix and suffix.

Please stick to using TILE_ prefix. And maybe TILEGX_ in the cases this is relevant.

Keep all the simple settings in the top of the file. Stuff like:
config ZONE_DMA
def_bool y

config SEMAPHORE_SLEEPERS
def_bool y

Belongs in the top of Kconfig - before your first menu.

There is also several TILE specific options missing the TILE_ prefix. Like:
config XGBE_MAIN
tristate "Tilera GBE/XGBE character device support"

Drop this:
config XGBE_MAIN
tristate "Tilera GBE/XGBE character device support"

It is better to test for the gcc version and disable the option only in the cases where it is known to fail.

arch/tile/Makefile:

Do not mess with CC like this:
CC = $(CROSS_COMPILE)gcc

I guess you had to do this to support:
LIBGCC_PATH := $(CC) -print-libgcc-file-name

If you follow other archs you could do like this:
LIBGCC_PATH := $(CC) -print-libgcc-file-name

This is not needed:
CLEAN_FILES += arch/tile/vmlinux.lds

vmlinux.lds lives in kernel/

help is missing.

arch/tile/kernel/Makefile
I has expected that compiling vmlinux.lds required knowledge on $(BITS) like this:
CPPFLAGS_vmlinux.lds := -m$(BITS)

arch/tile/kernel/vmlinux.lds.S
A lot of effort has been put into unifying the different variants of vmlinux.lds.
Please see the skeleton outlined in include/asm-generic/vmlinux.lds.h

You include sections.lds - but it is empty.
Drop that file.

You include hvglue.ld.
We use *.lds for linker script file - please rename. The file looks generated?? How and when?

Futhermore the definitions are not used by vmlinux.lds.S - so drop the include.

arch/tile/initramfs:
Does not look like it belongs in the kernel?

arch/tile/kernel/head_32.S
The file uses:
.section .text.head, "ax"
etc.

Please use the section definitions from include/linux/init.h

arch/tile/include/asm/spinlock.h
Please make this a one-liner when you uses the asm-generic version only. Same goes for byteorder (which includes linux/byteorder/little_endian.h)

In your mail you did not say anything about the checkpatch status. It is better that you make your code reasonable checkpatch clean _before_ merging. Then you will not be hit by a lot of janitorial patches doing so.

Likewise please state sparse status. We do not expect it to be sparse clean. But getting rid of the obvious issues is good too.

Sam

#75 lore raw
Quoted 2 lines · Sam Ravnborg

Kernle code looked good from a quick browsing.

Glad to hear it, and thanks for taking the time to look it over.

Quoted 3 lines

Please explain the need for all the different directories within include/ {arch, hv, netio}

Those three directories are shared with other components of our system. The "arch" headers are "core architecture" headers which can be used in any build environment (Linux, hypervisor, user-code, booter, other "supervisors" like VxWorks, etc.); they are partly small inline hacks to use the hardware more easily, and partly just lists of name-to-number mappings for special registers, etc. The "hv" headers are imported from the hypervisor code; these headers are "owned" by our hypervisor, and the ones shipped with Linux are the ones that have to do with how to run a supervisor under our hypervisor. The "netio" headers are another type of hypervisor header that have to do with interacting with the network I/O silicon on the chip (the 10 Gbe and 10/100/100 Mb Ethernet).

Quoted 5 lines

There is also several TILE specific options missing the TILE_ prefix. Like:
config XGBE_MAIN
tristate "Tilera GBE/XGBE character device support"

Quoted 7 lines

Drop this:
config XGBE_MAIN
tristate "Tilera GBE/XGBE character device support"

It is better to test for the gcc version and disable the option only in the cases where it is known to fail.

Is the "Drop this" comment a cut and paste bug? I'm guessing you were referring to CONFIG_WERROR, which enables -Werror support. The problem is that whether or not you can use -Werror really depends on not just the kernel version and the gcc version, but very likely also what drivers you have enabled. We always use it internally. I could also just pull this out completely (and just force it into "make" externally within our external build process), or move it to a "generic" configure option. In any case we can't just automate it, unfortunately.

Quoted 9 lines

Do not mess with CC like this:
CC = $(CROSS_COMPILE)gcc

I guess you had to do this to support:
LIBGCC_PATH := $(CC) -print-libgcc-file-name

If you follow other archs you could do like this:
LIBGCC_PATH := $(CC) -print-libgcc-file-name

I'm guessing you meant like what h8300 does, "$(shell $(CROSS-COMPILE)$(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)". That seems reasonable.

Quoted 5 lines

arch/tile/kernel/Makefile
I has expected that compiling vmlinux.lds required knowledge on $(BITS) like this:
CPPFLAGS_vmlinux.lds := -m$(BITS)

Our 32-bit chips only do 32-bit. In the 64-bit mode we always build the kernel implicitly -m64, which is the compiler default.

Quoted 5 lines

arch/tile/kernel/vmlinux.lds.S
A lot of effort has been put into unifying the different variants of vmlinux.lds.
Please see the skeleton outlined in include/asm-generic/vmlinux.lds.h

Yes, I've tried to track this somewhat over kernel releases, but I'll go back and re-examine it with fresh eyes.

Quoted 4 lines

You include hvglue.ld.
We use *.lds for linker script file - please rename. The file looks generated?? How and when?

It's sort of a semi-generated file. We have a test in our regressions that just tests that this file matches the API for our hypervisor, which is just calls to physical address =32KB plus 64 bytes per syscall number. These defined addresses are then used for calls to e.g. hv_flush_asid() or whatever. The hypervisor API changes occasionally, at which point we update this file. You don't see it used in vmlinux.lds since it's just used as plain C calls through the arch/tile/ code.

Quoted 3 lines

arch/tile/initramfs:
Does not look like it belongs in the kernel?

Fair enough. We ship it with the kernel to make it easy for our users to bootstrap up into a plausible initramfs filesystem, but it's strictly speaking not part of the kernel, so I'll remove it.

Quoted 4 lines

arch/tile/include/asm/spinlock.h
Please make this a one-liner when you uses the asm-generic version only. Same goes for byteorder (which includes linux/byteorder/little_endian.h)

I'm not sure what you mean when you say to use the asm-generic version of spinlock.h, since it's not SMP-ready. Also, I don't see an asm-generic/byteorder.h, so I'm puzzled there too.

Quoted 4 lines

In your mail you did not say anything about the checkpatch status. It is better that you make your code reasonable checkpatch clean _before_ merging. Then you will not be hit by a lot of janitorial patches doing so.

I ran checkpatch over everything I submitted. There are many complaints, to be sure, but I did a first pass cleaning up everything that was plausible, so for example all the style issues were fixed, but things like some uses of volatile, some uses of init_MUTEX, etc., were not modified. However, I think it's in decent shape from a checkpatch point of view.

Quoted 3 lines

Likewise please state sparse status. We do not expect it to be sparse clean. But getting rid of the obvious issues is good too.

I have not run sparse over it. I will do so.

Thanks for your review! Getting this much feedback from LKML is great -- I really appreciate it.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#76 lore raw
Quoted 9 lines
Quoted 9 lines

There is also several TILE specific options missing the TILE_ prefix. Like:
config XGBE_MAIN
tristate "Tilera GBE/XGBE character device support"

Drop this:
config XGBE_MAIN
tristate "Tilera GBE/XGBE character device support"

Quoted 5 lines
Quoted 3 lines

It is better to test for the gcc version and disable the option only in the cases where it is known to fail.

Is the "Drop this" comment a cut and paste bug?

Yep - sorry.

Quoted 8 lines

I'm guessing you were
referring to CONFIG_WERROR, which enables -Werror support. The problem is that whether or not you can use -Werror really depends on not just the kernel version and the gcc version, but very likely also what drivers you have enabled. We always use it internally. I could also just pull this out completely (and just force it into "make" externally within our external build process), or move it to a "generic" configure option. In any case we can't just automate it, unfortunately.

As Arnd pointed out the drivers does not belong in the arch/tile/* hirachy.
And we have some architectures that always uses -Werror unconditionally. So for the arch part this way to deal with it should be safe. And the more we can cover under -Werror the better.

I dunno how you best deal with the drivers.

Quoted 7 lines
Quoted 7 lines

Do not mess with CC like this:
CC = $(CROSS_COMPILE)gcc

I guess you had to do this to support:
LIBGCC_PATH := $(CC) -print-libgcc-file-name

Quoted 7 lines
Quoted 3 lines

If you follow other archs you could do like this:
LIBGCC_PATH := $(CC) -print-libgcc-file-name

I'm guessing you meant like what h8300 does, "$(shell $(CROSS-COMPILE)$(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)". That seems reasonable.

Correct - you are good at guessing :-)

Quoted 8 lines
Quoted 4 lines

arch/tile/include/asm/spinlock.h
Please make this a one-liner when you uses the asm-generic version only. Same goes for byteorder (which includes linux/byteorder/little_endian.h)

I'm not sure what you mean when you say to use the asm-generic version of spinlock.h, since it's not SMP-ready. Also, I don't see an asm-generic/byteorder.h, so I'm puzzled there too.

What I wanted to say was that a header file that simply include another header file then drop all the boilerplate stuff and let the header file be a single line.
Both spinlock.h and byteorder.h matches this.

The other 15+ header files that simply include another heder file you follow this style. So this is a small matter of consistency.

Quoted 6 lines
Quoted 5 lines

In your mail you did not say anything about the checkpatch status. It is better that you make your code reasonable checkpatch clean _before_ merging. Then you will not be hit by a lot of janitorial patches doing so.

Quoted 6 lines

I ran checkpatch over everything I submitted. There are many complaints, to be sure, but I did a first pass cleaning up everything that was plausible, so for example all the style issues were fixed, but things like some uses of volatile, some uses of init_MUTEX, etc., were not modified. However, I think it's in decent shape from a checkpatch point of view.

Good. Please include this information in you next submission.

Sam

#77 lore raw
In reply to Chris Metcalf

Chris,

Quoted 4 lines · Chris Metcalf

We are using the http://www.tilera.com/scm/ web site to push Tilera-modified sources back up to the community. At the moment, the arch/tile hierarchy is there (as a bzipped tarball) as well as a copy of the patch appended to this email. In addition, our gcc, binutils,

it would be very helpful for review if you could split your patches into different topics and send a patch series. Though I grabbed the all in one patch and looked at irq.c and time.c. Comments inlined below.

--- /dev/null
+++ b/arch/tile/kernel/irq.c

+struct tile_irq_desc {
+ void (*handler)(void *);
+ void *dev_id;
+};
+
+struct tile_irq_desc tile_irq_desc[NR_IRQS] __cacheline_aligned; +
+/**
+ * tile_request_irq() - Allocate an interrupt handling instance.
+ * @handler: the device driver interrupt handler to be called.
+ * @dev_id: a cookie passed back to the handler function.
+ * @index: index into the interrupt handler table to set. It's
+ * derived from the interrupt bit mask allocated by the HV.
+ *
+ * Each device should call this function to register its interrupt
+ * handler. dev_id must be globally unique. Normally the address of the
+ * device data structure is used as the cookie.

Why are you implementing your private interrupt handling infrastructure ? What's wrong with the generic interrupt handling code ? Why is each device driver forced to call tile_request_irq() which makes it incompatible to the rest of the kernel and therefor unshareable ?

+ */
+void tile_request_irq(void (*handler)(void *), void *dev_id, int index) +{
+ struct tile_irq_desc *irq_desc;
+
+ BUG_ON(!handler);
+ BUG_ON(index < 0 || index >= NR_IRQS);
+
+ irq_desc = tile_irq_desc + index;
+ irq_desc->handler = handler;
+ irq_desc->dev_id = dev_id;
+}
+EXPORT_SYMBOL(tile_request_irq);
+
+void tile_free_irq(int index)
+{
+ struct tile_irq_desc *irq_desc;
+
+ BUG_ON(index < 0 || index >= NR_IRQS);
+
+ irq_desc = tile_irq_desc + index;
+ irq_desc->handler = NULL;
+ irq_desc->dev_id = NULL;
+}
+EXPORT_SYMBOL(tile_free_irq);

That code lacks any kind of protection and serialization.

+ for (count = 0; pending_dev_intr_mask; ++count) {
+ if (pending_dev_intr_mask & 0x1) {
+ struct tile_irq_desc *desc = &tile_irq_desc[count];
+ if (desc->handler == NULL) {
+ printk(KERN_ERR "Ignoring hv dev interrupt %d;"
+ " handler not registered!\n", count);
+ } else {
+ desc->handler(desc->dev_id);

You check desc->handler, but you happily call the handler while dev_id might be still NULL. See above.

+/*
+From struct irq_chip (same as hv_interrupt_type):
+ const char name;
+ unsigned int startup - has default, calls enable
+ void shutdown - has default, calls disable
+ void enable - has default, calls unmask
+ void disable - has default, calls mask
+ void ack - required
+ void mask - required
+ void mask_ack - optional - calls mask,ack
+ void unmask - required - optional for some?
+ void eoi - required for for fasteoi, percpu
+ void end - not used
+ void set_affinity
+ int retrigger - optional
+ int set_type - optional
+ int set_wake - optional
+ void release - optional
+*/

Please do not replicate the comments from include/linux/irq.h as they are subject to change.

+/*
+ * Generic, controller-independent functions:
+ */
+
+int show_interrupts(struct seq_file *p, void *v)
+{
+ int i = *(loff_t *) v, j;
+ struct irqaction *action;
+ unsigned long flags;
+
+ if (i == 0) {
+ seq_printf(p, " ");
+ for (j = 0; j < NR_CPUS; j++)
+ if (cpu_online(j))
+ seq_printf(p, "CPU%-8d", j);
+ seq_putc(p, '\n');
+ }
+
+ if (i < NR_IRQS) {
+ raw_spin_lock_irqsave(&irq_desc[i].lock, flags);
+ action = irq_desc[i].action;
+ if (!action)
+ goto skip;
+ seq_printf(p, "%3d: ", i);
+#ifndef CONFIG_SMP
+ seq_printf(p, "%10u ", kstat_irqs(i));
+#else
+ for_each_online_cpu(j)
+ seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
+#endif
+ seq_printf(p, " %14s", irq_desc[i].chip->typename);
+ seq_printf(p, " %s", action->name);
+
+ for (action = action->next; action; action = action->next)
+ seq_printf(p, ", %s", action->name);
+
+ seq_putc(p, '\n');
+skip:
+ raw_spin_unlock_irqrestore(&irq_desc[i].lock, flags);
+ }
+ return 0;

So that prints which interrupts ? Now you refer to the generic code, while above you require that tile specific one. -ENOSENSE.

+}
+/*
+ * This is used with the handle_level_irq handler for legacy
+ * interrupts.
+ *
+ * These functions can probably be reused with edge sensitive
+ * interrupts.
+ */
+static struct irq_chip chip_irq_legacy = {
+ .typename = "TILE-LEGACY",
+ .mask_ack = chip_mask_ack_level,
+ .disable = chip_disable_interrupt,
+ .eoi = NULL,

No need for NULL initialization

+ .unmask = chip_unmask_level,
+};
+
+static struct irq_chip chip_irq_edge = {
+ .typename = "TILE-EDGE",
+ .mask = chip_mask_edge,
+ .eoi = NULL,

Ditto

+ .ack = chip_ack_edge,
+ .unmask = chip_unmask_edge,
+};
+
+/*
+ * Handler for PCI IRQs. This acts as a shim between the IRQ
+ * framework at the top of this file and the conventional linux framework.
+ * Invoked from tile_dev_intr() as a handler, with interrupts disabled.

Why do you need this shim layer at all ?

+ */
+static void tile_irq_shim(void *dev)
+{
+ int hv_irq = (int)(unsigned long)dev;
+
+
+
+ generic_handle_irq(hv_irq);
+}

--- /dev/null
+++ b/arch/tile/kernel/time.c

+/* How many cycles per second we are running at. */ +static cycles_t cycles_per_sec __write_once; +static u32 cyc2ns_mult __write_once; +#define cyc2ns_shift 30

Please do not use fixed shift values. Use the generic functions to calculate the optimal shift/mult pairs instead.

+cycles_t get_clock_rate() { return cycles_per_sec; }

Eek. Please use proper coding style.

+
+/*
+ * Called very early from setup_arch() to set cycles_per_sec.
+ * Also called, if required, by sched_clock(), which can be even
+ * earlier if built with CONFIG_LOCKDEP (during lockdep_init).
+ * We initialize it early so we can use it to set up loops_per_jiffy.
+ */
+void setup_clock(void)
+{
+ u64 mult;
+
+ if (cyc2ns_mult)
+ return;
+ cycles_per_sec = hv_sysconf(HV_SYSCONF_CPU_SPEED);
+
+ /*
+ * Compute cyc2ns_mult, as used in sched_clock().
+ * For efficiency of multiplication we want this to be a
+ * 32-bit value, so we validate that here. We want as large a
+ * shift value as possible for precision, but too large a
+ * shift would make cyc2ns_mult more than 32 bits. We pick a
+ * constant value that works well with our typical
+ * frequencies, though we could in principle compute the most
+ * precise value dynamically instead. We can't make the shift
+ * greater than 32 without fixing the algorithm.
+ */
+ mult = (1000000000ULL << cyc2ns_shift) / cycles_per_sec;
+ cyc2ns_mult = (u32) mult;
+ BUILD_BUG_ON(cyc2ns_shift > 32);
+ BUG_ON(mult != cyc2ns_mult);

See above.

+}
+
+#if CHIP_HAS_SPLIT_CYCLE()

That should be a CONFIG_TILE_HAS_SPLIT_CYCLE and not a function like macro define somewhere in a header file.

+cycles_t get_cycles()
+{
+ return get_cycle_count();
+}
+#endif
+
+cycles_t clocksource_get_cycles(struct clocksource *cs) +{
+ return get_cycles();
+}
+
+static struct clocksource cycle_counter_clocksource = {
+ .name = "cycle counter",
+ .rating = 300,
+ .read = clocksource_get_cycles,
+ .mask = CLOCKSOURCE_MASK(64),
+ .flags = CLOCK_SOURCE_IS_CONTINUOUS,
+};
+
+/* Called fairly late in init/main.c, but before we go smp. */ +void __init time_init(void)
+{
+ struct clocksource *src = &cycle_counter_clocksource;
+
+ /* Pick an arbitrary time to start us up. */
+ xtime.tv_sec = mktime(1970, 1, 1, 0, 0, 0);
+ xtime.tv_nsec = 0;

Please do not touch xtime. The core code sets it to 1970 already.

+ /* Initialize and register the clock source. */
+ src->shift = 20; /* arbitrary */
+ src->mult = (1000000000ULL << src->shift) / cycles_per_sec;

See above.

+ clocksource_register(src);
+
+ /* Start up the tile-timer interrupt source on the boot cpu. */
+ setup_tile_timer();
+}
+
+
+/*
+ * Provide support for effectively turning the timer interrupt on and
+ * off via the interrupt mask. Make sure not to unmask it while we are
+ * running the timer interrupt handler, to avoid recursive timer
+ * interrupts; these may be OK in some cases, but it's generally cleaner
+ * to reset the kernel stack before starting the next timer interrupt.

Which would already be guaranteed by the generic interrupt code .... The clockevent callbacks are already called with interrupts disabled, so why all this magic ?

+ */
+
+/* Track some status about the timer interrupt. */
+struct timer_status {
+ int enabled; /* currently meant to be enabled? */
+ int in_intr; /* currently in the interrupt handler? */
+};
+static DEFINE_PER_CPU(struct timer_status, timer_status);
+
+/* Enable the timer interrupt, unless we're in the handler. */ +static void enable_timer_intr(void)
+{
+ struct timer_status *status = &__get_cpu_var(timer_status);
+ status->enabled = 1;
+ if (status->in_intr)
+ return;
+ raw_local_irq_unmask_now(INT_TILE_TIMER);
+}
+
+/* Disable the timer interrupt. */
+static void disable_timer_intr(void)
+{
+ struct timer_status *status = &__get_cpu_var(timer_status);
+ status->enabled = 0;
+ raw_local_irq_mask_now(INT_TILE_TIMER);
+}
+
+/* Mark the start of processing for the timer interrupt. */ +static void start_timer_intr(void)
+{
+ struct timer_status *status = &__get_cpu_var(timer_status);
+ status->in_intr = 1;
+ disable_timer_intr();
+}
+
+/* Mark end of processing for the timer interrupt, unmasking if necessary. */ +static void end_timer_intr(void)
+{
+ struct timer_status *status = &__get_cpu_var(timer_status);
+ status->in_intr = 0;
+ if (status->enabled)
+ enable_timer_intr();
+}
+
+
+/*
+ * Define the tile timer clock event device. The timer is driven by
+ * the TILE_TIMER_CONTROL register, which consists of a 31-bit down
+ * counter, plus bit 31, which signifies that the counter has wrapped
+ * from zero to (2**31) - 1. The INT_TILE_TIMER interrupt will be
+ * raised as long as bit 31 is set.
+ */
+
+#define MAX_TICK 0x7fffffff /* we have 31 bits of countdown timer */
+
+static int tile_timer_set_next_event(unsigned long ticks,
+ struct clock_event_device *evt)
+{
+ BUG_ON(ticks > MAX_TICK);
+ __insn_mtspr(SPR_TILE_TIMER_CONTROL, ticks);
+ enable_timer_intr();
+ return 0;
+}
+
+/*
+ * Whenever anyone tries to change modes, we just mask interrupts
+ * and wait for the next event to get set.
+ */
+static void tile_timer_set_mode(enum clock_event_mode mode,
+ struct clock_event_device *evt)
+{
+ disable_timer_intr();
+}
+
+static DEFINE_PER_CPU(struct clock_event_device, tile_timer) = {
+ .name = "tile timer",
+ .features = CLOCK_EVT_FEAT_ONESHOT,
+ .min_delta_ns = 1000, /* at least 1000 cycles to fire the interrupt */

That's not cycles. That's nano seconds ! And please avoid tail comments.

+ .rating = 100,
+ .irq = -1,
+ .set_next_event = tile_timer_set_next_event,
+ .set_mode = tile_timer_set_mode,
+};
+
+void __cpuinit setup_tile_timer(void)
+{
+ struct clock_event_device *evt = &__get_cpu_var(tile_timer);
+
+ /* Fill in fields that are speed-specific. */
+ evt->shift = 20; /* arbitrary */
+ evt->mult = (cycles_per_sec << evt->shift) / 1000000000ULL;

See above.

+ evt->max_delta_ns = (MAX_TICK * 1000000000ULL) / cycles_per_sec;

There is a generic function for this as well. Please use it.

+ /* Mark as being for this cpu only. */
+ evt->cpumask = cpumask_of(smp_processor_id());
+
+ /* Start out with timer not firing. */
+ disable_timer_intr();
+
+ /* Register tile timer. */
+ clockevents_register_device(evt);
+}
+
+/* Called from the interrupt vector. */
+void do_timer_interrupt(struct pt_regs *regs, int fault_num) +{
+ struct pt_regs *old_regs = set_irq_regs(regs);
+ struct clock_event_device *evt = &__get_cpu_var(tile_timer);
+
+ /* Mask timer interrupts in case someone enable interrupts later. */
+ start_timer_intr();

Nothing enables interrupts in the timer interrupt handler code path.

+ /* Track time spent here in an interrupt context */
+ irq_enter();
+
+ /* Track interrupt count. */
+ __get_cpu_var(irq_stat).irq_timer_count++;
+
+ /* Call the generic timer handler */
+ evt->event_handler(evt);
+
+ /*
+ * Track time spent against the current process again and
+ * process any softirqs if they are waiting.
+ */
+ irq_exit();
+
+ /*
+ * Enable the timer interrupt (if requested) with irqs disabled,
+ * so we don't get recursive timer interrupts.
+ */
+ local_irq_disable();

The code above does _NOT_ reenable interrupts. And if it would, then you would break irq_exit() assumptions as well.

+ end_timer_intr();
+
+ set_irq_regs(old_regs);
+}
+
+/*
+ * Scheduler clock - returns current time in nanosec units.
+ *
+ * The normal algorithm computes (cycles * cyc2ns_mult) >> cyc2ns_shift.
+ * We can make it potentially more efficient and with a better range
+ * by writing "cycles" as two 32-bit components, "(H << 32) + L" and
+ * then factoring. Here we use M = cyc2ns_mult and S = cyc2ns_shift.
+ *
+ * (((H << 32) + L) * M) >> S =
+ * (((H << 32) * M) >> S) + ((L * M) >> S) =
+ * ((H * M) << (32 - S)) + ((L * M) >> S)
+ */
+unsigned long long sched_clock(void)
+{
+ u64 cycles;
+ u32 cyc_hi, cyc_lo;
+
+ if (unlikely(cyc2ns_mult == 0))
+ setup_clock();

Please initialize stuff _before_ it is called the first time and not at some arbitrary point conditionally in a hotpath.

+
+ cycles = get_cycles();
+ cyc_hi = (u32) (cycles >> 32);
+ cyc_lo = (u32) (cycles);
+
+ /* Compiler could optimize the 32x32 -> 64 multiplies here. */
+ return ((cyc_hi * (u64)cyc2ns_mult) << (32 - cyc2ns_shift)) +
+ ((cyc_lo * (u64)cyc2ns_mult) >> cyc2ns_shift);
+}
+
+int setup_profiling_timer(unsigned int multiplier) +{
+ return -EINVAL;
+}

Thanks,

tglx

#78 lore raw

Thomas, thanks for your feedback. If I don't comment on something you said it's because you were obviously right and I applied a suitable fix. :-)

Quoted 10 lines · Thomas Gleixner

+/**
+ * tile_request_irq() - Allocate an interrupt handling instance. [...]

Why are you implementing your private interrupt handling infrastructure ? What's wrong with the generic interrupt handling code ? Why is each device driver forced to call tile_request_irq() which makes it incompatible to the rest of the kernel and therefor unshareable ?

Our interrupt management code has evolved as we have developed this code, so I won't present arguments as to why it's perfect the way it is, but just why it IS the way it is. :-)

The tile irq.c does not replace the generic Linux IRQ management code, but instead provides a very limited set of virtual interrupts that are only used by our para-virtualized device drivers, and delivered to Linux via a single hypervisor downcall that atomically sets "virtual interrupt" bits in a bitmask. The PCI root complex driver reserves four of these bits (i.e. irqs) to map real PCI interrupts; they are then fed forward into the regular Linux IRQ system to manage all "standard" devices. The other tile-specific para-virtualized drivers that use this interface are the PCI endpoint code, xgbe network driver, ATA-over-GPIO driver, and the IPI layer. None of these para-virtualized drivers are actually shareable with other Linux architectures in any case.

We have an outstanding enhancement request in our bug tracking system to switch to using the Linux generic IRQs directly, and plan to implement it prior to our next major release. But we haven't done it yet, and this code, though somewhat crufty, is reasonably stable. I'm also not the primary maintainer of this particular piece of code, so I'd rather wait until that person frees up and have him do it, instead of trying to hack it myself.

In any case, I'll add commentary material (probably just an edited version of the explanatory paragraph above) into irq.c so at least it's clear what's going on.

Quoted 5 lines

+void tile_free_irq(int index)
+[...]

That code lacks any kind of protection and serialization.

Interesting point. As it happens, these calls are all made during boot, so they are serialized that way. But in principle we could use the xgbe driver as a module, at least, so you're right; I'll add a spinlock.

Quoted 5 lines

[...]

You check desc->handler, but you happily call the handler while dev_id might be still NULL. See above.

Assuming we spinlock the irq request/free routines, I think this is safe, since the unlock memory fence will guarantee visibility of the fields prior to any attempt to use them. We always allocate the interrupt, then tell the hypervisor to start delivering them; on device unload we tell the hypervisor to stop delivering interrupts, then free it. The "tell the hypervisor" steps use on_each_cpu() and wait, so are fully synchronous.

Review

Quoted 10 lines
(quoted diff) +6 -0
+/*
+ * Generic, controller-independent functions:
+ */
+
+int show_interrupts(struct seq_file *p, void *v)
+[...]
 
  So that prints which interrupts ? Now you refer to the generic code,
  while above you require that tile specific one. -ENOSENSE.

Yes, this is confusing. This routine is required by procfs, and it shows just the PCI interrupts, not the tile irqs. I'll add a comment, and try to segregate the file into "generic irqs" and "tile irqs" more obviously, for now. The routine itself will be more sensible once we integrate our tile_irqs into the generic system.

Review

Quoted 8 lines
(quoted diff) +4 -0
+/* How many cycles per second we are running at. */
+static cycles_t cycles_per_sec __write_once;
+static u32 cyc2ns_mult __write_once;
+#define cyc2ns_shift 30
 
  Please do not use fixed shift values. Use the generic functions to
  calculate the optimal shift/mult pairs instead. 

Thanks; I wasn't aware of these. I'll switch the code over to use them, and the other helper functions you pointed out.

Quoted 5 lines

+#if CHIP_HAS_SPLIT_CYCLE()

That should be a CONFIG_TILE_HAS_SPLIT_CYCLE and not a function like macro define somewhere in a header file.

This is not a configurable option. The <arch/chip.h> header (which is not a Linux header per-se, but one of our "core architecture" headers that can be used in any programming context) provides a set of CHIP_xxx() macros. We use a functional macro style because we saw too many instances of "#ifdef CHIP_FOO_MISSPELLED" where the misspelling wasn't noticed until much later.

Quoted 11 lines

+/*
+ * Provide support for effectively turning the timer interrupt on and
+ * off via the interrupt mask. Make sure not to unmask it while we are
+ * running the timer interrupt handler, to avoid recursive timer
+ * interrupts; these may be OK in some cases, but it's generally cleaner
+ * to reset the kernel stack before starting the next timer interrupt.

Which would already be guaranteed by the generic interrupt code .... The clockevent callbacks are already called with interrupts disabled, so why all this magic ?

The code was written so that it would be robust in the face of the timer interrupt-path code potentially enabling interrupts, since I couldn't convince myself it didn't. I'll rip out all that code and replace it with a couple of BUG() checks instead. Thanks, that's a nice cleanup.

And thanks again for the feedback. It's very helpful.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#79 lore raw
In reply to Thomas Gleixner

Review

Quoted 11 lines · Thomas Gleixner
(quoted diff) +7 -0
+unsigned long long sched_clock(void)
+{
+	u64 cycles;
+	u32 cyc_hi, cyc_lo;
+
+	if (unlikely(cyc2ns_mult == 0))
+		setup_clock();
 
  Please initialize stuff _before_ it is called the first time and not
  at some arbitrary point conditionally in a hotpath.

Looking more closely at this, the reason for this lazy initialization was that sched_clock() can be called from lockdep_init(), which runs way before any tasteful architecture-specific initialization can happen. Perhaps the correct model is that during the early stages of boot, we are happy to shift by zero, multiply by zero, and claim the time is zero :-)

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
maintainer
#80 lore raw
Quoted 9 lines · On Wednesday 26 May 2010 18:22:33 Chris Metcalf wrote:
Quoted 8 lines · Thomas Gleixner
(quoted diff) +7 -0
+unsigned long long sched_clock(void)
+{
+     u64 cycles;
+     u32 cyc_hi, cyc_lo;
+
+     if (unlikely(cyc2ns_mult == 0))
+             setup_clock();
Quoted 9 lines
Quoted 3 lines

Please initialize stuff before it is called the first time and not at some arbitrary point conditionally in a hotpath.

Looking more closely at this, the reason for this lazy initialization was that sched_clock() can be called from lockdep_init(), which runs way before any tasteful architecture-specific initialization can happen. Perhaps the correct model is that during the early stages of boot, we are happy to shift by zero, multiply by zero, and claim the time is zero :-)

Yes, that is what other architectures do. The time remains zero during early boot. setup_arch is probably a good place to start the clock.

Arnd

#81 lore raw

PATCH 1/8 Fix up the "generic" unistd.h ABI to be more useful.

In reply to Chris Metcalf

Reserve 16 "architecture-specific" syscall numbers starting at 244.

Allow use of the sys_sync_file_range2() API with the generic unistd.h by specifying __ARCH_WANT_SYNC_FILE_RANGE2 before including it.

Allow using the generic unistd.h to create the "compat" syscall table by specifying __SYSCALL_COMPAT before including it.

Use sys_fadvise64_64 for __NR3264_fadvise64 in both 32- and 64-bit mode.

Request the appropriate __ARCH_WANT_COMPAT_SYS_xxx values when some deprecated syscall modes are selected.

As part of this change to fix up the syscalls, also provide a couple of missing signal-related syscall prototypes in <linux/syscalls.h>.

---
 include/asm-generic/unistd.h |   26 ++++++++++++++++++++------
 include/linux/syscalls.h     |    4 ++++
 2 files changed, 24 insertions(+), 6 deletions(-)
include/asm-generic/unistd.h +20 -6
index 6a0b30f..30218b4 100644
@@ -18,7 +18,7 @@
 #define __SYSCALL(x, y)
 #endif
 
-#if __BITS_PER_LONG == 32
+#if __BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)
 #define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32)
 #else
 #define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64)
@@ -241,8 +241,13 @@ __SYSCALL(__NR_sync, sys_sync)
 __SYSCALL(__NR_fsync, sys_fsync)
 #define __NR_fdatasync 83
 __SYSCALL(__NR_fdatasync, sys_fdatasync)
+#ifdef __ARCH_WANT_SYNC_FILE_RANGE2
+#define __NR_sync_file_range2 84
+__SYSCALL(__NR_sync_file_range2, sys_sync_file_range2)
+#else
 #define __NR_sync_file_range 84
-__SYSCALL(__NR_sync_file_range, sys_sync_file_range) /* .long sys_sync_file_range2, */
+__SYSCALL(__NR_sync_file_range, sys_sync_file_range)
+#endif
 
 /* fs/timerfd.c */
 #define __NR_timerfd_create 85
@@ -580,7 +585,7 @@ __SYSCALL(__NR_execve, sys_execve)	/* .long sys_execve_wrapper */
 __SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap)
 /* mm/fadvise.c */
 #define __NR3264_fadvise64 223
-__SC_3264(__NR3264_fadvise64, sys_fadvise64_64, sys_fadvise64)
+__SYSCALL(__NR3264_fadvise64, sys_fadvise64_64)
 
 /* mm/, CONFIG_MMU only */
 #ifndef __ARCH_NOMMU
@@ -627,8 +632,14 @@ __SYSCALL(__NR_accept4, sys_accept4)
 #define __NR_recvmmsg 243
 __SYSCALL(__NR_recvmmsg, sys_recvmmsg)
 
+/*
+ * Architectures may provide up to 16 syscalls of their own
+ * starting with this value.
+ */
+#define __NR_arch_specific_syscall 244
+
 #undef __NR_syscalls
-#define __NR_syscalls 244
+#define __NR_syscalls 260
 
 /*
  * All syscalls below here should go away really,
@@ -694,7 +705,8 @@ __SYSCALL(__NR_signalfd, sys_signalfd)
 #define __NR_syscalls (__NR_signalfd+1)
 #endif /* __ARCH_WANT_SYSCALL_NO_FLAGS */
 
-#if __BITS_PER_LONG == 32 && defined(__ARCH_WANT_SYSCALL_OFF_T)
+#if (__BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)) && \
+     defined(__ARCH_WANT_SYSCALL_OFF_T)
 #define __NR_sendfile 1046
 __SYSCALL(__NR_sendfile, sys_sendfile)
 #define __NR_ftruncate 1047
@@ -740,6 +752,7 @@ __SYSCALL(__NR_getpgrp, sys_getpgrp)
 __SYSCALL(__NR_pause, sys_pause)
 #define __NR_time 1062
 #define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_COMPAT_SYS_TIME
 __SYSCALL(__NR_time, sys_time)
 #define __NR_utime 1063
 #define __ARCH_WANT_SYS_UTIME
@@ -801,7 +814,7 @@ __SYSCALL(__NR_fork, sys_ni_syscall)
  * Here we map the numbers so that both versions
  * use the same syscall table layout.
  */
-#if __BITS_PER_LONG == 64
+#if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
 #define __NR_fcntl __NR3264_fcntl
 #define __NR_statfs __NR3264_statfs
 #define __NR_fstatfs __NR3264_fstatfs
@@ -848,6 +861,7 @@ __SYSCALL(__NR_fork, sys_ni_syscall)
 #endif
 #define __ARCH_WANT_SYS_RT_SIGACTION
 #define __ARCH_WANT_SYS_RT_SIGSUSPEND
+#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
 
 /*
  * "Conditional" syscalls
include/linux/syscalls.h +4 -0
index 057929b..d39ddb3 100644
@@ -387,9 +387,13 @@ asmlinkage long sys_init_module(void __user *umod, unsigned long len,
 asmlinkage long sys_delete_module(const char __user *name_user,
 				unsigned int flags);
 
+asmlinkage long sys_rt_sigaction(int sig, const struct sigaction __user *act,
+				 struct sigaction __user *oact,
+				 size_t sigsetsize);
 asmlinkage long sys_rt_sigprocmask(int how, sigset_t __user *set,
 				sigset_t __user *oset, size_t sigsetsize);
 asmlinkage long sys_rt_sigpending(sigset_t __user *set, size_t sigsetsize);
+asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize);
 asmlinkage long sys_rt_sigtimedwait(const sigset_t __user *uthese,
 				siginfo_t __user *uinfo,
 				const struct timespec __user *uts,
Signature · 1 line
1.6.5.2
#82 lore raw

PATCH 1/8 Fix up the "generic" unistd.h ABI to be more useful.

In reply to Chris Metcalf

Reserve 16 "architecture-specific" syscall numbers starting at 244.

Allow use of the sys_sync_file_range2() API with the generic unistd.h by specifying __ARCH_WANT_SYNC_FILE_RANGE2 before including it.

Allow using the generic unistd.h to create the "compat" syscall table by specifying __SYSCALL_COMPAT before including it.

Use sys_fadvise64_64 for __NR3264_fadvise64 in both 32- and 64-bit mode.

Request the appropriate __ARCH_WANT_COMPAT_SYS_xxx values when some deprecated syscall modes are selected.

As part of this change to fix up the syscalls, also provide a couple of missing signal-related syscall prototypes in <linux/syscalls.h>.

---
 include/asm-generic/unistd.h |   26 ++++++++++++++++++++------
 include/linux/syscalls.h     |    4 ++++
 2 files changed, 24 insertions(+), 6 deletions(-)
include/asm-generic/unistd.h +20 -6
index 6a0b30f..30218b4 100644
@@ -18,7 +18,7 @@
 #define __SYSCALL(x, y)
 #endif
 
-#if __BITS_PER_LONG == 32
+#if __BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)
 #define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32)
 #else
 #define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64)
@@ -241,8 +241,13 @@ __SYSCALL(__NR_sync, sys_sync)
 __SYSCALL(__NR_fsync, sys_fsync)
 #define __NR_fdatasync 83
 __SYSCALL(__NR_fdatasync, sys_fdatasync)
+#ifdef __ARCH_WANT_SYNC_FILE_RANGE2
+#define __NR_sync_file_range2 84
+__SYSCALL(__NR_sync_file_range2, sys_sync_file_range2)
+#else
 #define __NR_sync_file_range 84
-__SYSCALL(__NR_sync_file_range, sys_sync_file_range) /* .long sys_sync_file_range2, */
+__SYSCALL(__NR_sync_file_range, sys_sync_file_range)
+#endif
 
 /* fs/timerfd.c */
 #define __NR_timerfd_create 85
@@ -580,7 +585,7 @@ __SYSCALL(__NR_execve, sys_execve)	/* .long sys_execve_wrapper */
 __SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap)
 /* mm/fadvise.c */
 #define __NR3264_fadvise64 223
-__SC_3264(__NR3264_fadvise64, sys_fadvise64_64, sys_fadvise64)
+__SYSCALL(__NR3264_fadvise64, sys_fadvise64_64)
 
 /* mm/, CONFIG_MMU only */
 #ifndef __ARCH_NOMMU
@@ -627,8 +632,14 @@ __SYSCALL(__NR_accept4, sys_accept4)
 #define __NR_recvmmsg 243
 __SYSCALL(__NR_recvmmsg, sys_recvmmsg)
 
+/*
+ * Architectures may provide up to 16 syscalls of their own
+ * starting with this value.
+ */
+#define __NR_arch_specific_syscall 244
+
 #undef __NR_syscalls
-#define __NR_syscalls 244
+#define __NR_syscalls 260
 
 /*
  * All syscalls below here should go away really,
@@ -694,7 +705,8 @@ __SYSCALL(__NR_signalfd, sys_signalfd)
 #define __NR_syscalls (__NR_signalfd+1)
 #endif /* __ARCH_WANT_SYSCALL_NO_FLAGS */
 
-#if __BITS_PER_LONG == 32 && defined(__ARCH_WANT_SYSCALL_OFF_T)
+#if (__BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)) && \
+     defined(__ARCH_WANT_SYSCALL_OFF_T)
 #define __NR_sendfile 1046
 __SYSCALL(__NR_sendfile, sys_sendfile)
 #define __NR_ftruncate 1047
@@ -740,6 +752,7 @@ __SYSCALL(__NR_getpgrp, sys_getpgrp)
 __SYSCALL(__NR_pause, sys_pause)
 #define __NR_time 1062
 #define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_COMPAT_SYS_TIME
 __SYSCALL(__NR_time, sys_time)
 #define __NR_utime 1063
 #define __ARCH_WANT_SYS_UTIME
@@ -801,7 +814,7 @@ __SYSCALL(__NR_fork, sys_ni_syscall)
  * Here we map the numbers so that both versions
  * use the same syscall table layout.
  */
-#if __BITS_PER_LONG == 64
+#if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
 #define __NR_fcntl __NR3264_fcntl
 #define __NR_statfs __NR3264_statfs
 #define __NR_fstatfs __NR3264_fstatfs
@@ -848,6 +861,7 @@ __SYSCALL(__NR_fork, sys_ni_syscall)
 #endif
 #define __ARCH_WANT_SYS_RT_SIGACTION
 #define __ARCH_WANT_SYS_RT_SIGSUSPEND
+#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
 
 /*
  * "Conditional" syscalls
include/linux/syscalls.h +4 -0
index 057929b..d39ddb3 100644
@@ -387,9 +387,13 @@ asmlinkage long sys_init_module(void __user *umod, unsigned long len,
 asmlinkage long sys_delete_module(const char __user *name_user,
 				unsigned int flags);
 
+asmlinkage long sys_rt_sigaction(int sig, const struct sigaction __user *act,
+				 struct sigaction __user *oact,
+				 size_t sigsetsize);
 asmlinkage long sys_rt_sigprocmask(int how, sigset_t __user *set,
 				sigset_t __user *oset, size_t sigsetsize);
 asmlinkage long sys_rt_sigpending(sigset_t __user *set, size_t sigsetsize);
+asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize);
 asmlinkage long sys_rt_sigtimedwait(const sigset_t __user *uthese,
 				siginfo_t __user *uinfo,
 				const struct timespec __user *uts,
Signature · 1 line
1.6.5.2
#83 lore raw

PATCH 2/8 arch/tile: infrastructure and configuration-related files.

In reply to Chris Metcalf

This change updates MAINTAINERS and provides the top-level configuration and build files, and the default configuration.

---
 MAINTAINERS                      |    6 +
 arch/tile/Kbuild                 |    3 +
 arch/tile/Kconfig                |  360 +++++++++++
 arch/tile/Kconfig.debug          |   43 ++
 arch/tile/Makefile               |   52 ++
 arch/tile/configs/tile_defconfig | 1289 ++++++++++++++++++++++++++++++++++++++
 6 files changed, 1753 insertions(+), 0 deletions(-)
 create mode 100644 arch/tile/Kbuild
 create mode 100644 arch/tile/Kconfig
 create mode 100644 arch/tile/Kconfig.debug
 create mode 100644 arch/tile/Makefile
 create mode 100644 arch/tile/configs/tile_defconfig
MAINTAINERS +6 -0
index 8e01948..438bfe0 100644
@@ -5521,6 +5521,12 @@ F:	include/linux/tipc*.h
 F:	include/net/tipc/
 F:	net/tipc/
 
+TILE ARCHITECTURE
+M:	Chris Metcalf <[email protected]>
+W:	http://www.tilera.com/scm/
+S:	Supported
+F:	arch/tile/
+
 TLAN NETWORK DRIVER
 M:	Samuel Chessman <[email protected]>
 L:	[email protected] (subscribers-only)
arch/tile/Kbuild new file +3 -0
new file mode 100644
index 0000000..a9b9227
@@ -0,0 +1,3 @@
+
+obj-y += kernel/
+obj-y += mm/
arch/tile/Kconfig new file +360 -0

360 lines not on this page · raw message

arch/tile/Kconfig.debug new file +43 -0

43 lines not on this page · raw message

arch/tile/Makefile new file +52 -0

52 lines not on this page · raw message

arch/tile/configs/tile_defconfig new file +1289 -0

1,289 lines not on this page · raw message

Signature · 1 line
1.6.5.2
#84 lore raw

Re: [PATCH 2/8] arch/tile: infrastructure and configuration-related files.

arch/tile/Kconfig line 25

Quoted 3 lines · Chris Metcalf
arch/tile/Kconfig new file +3 -0
+config ZONE_DMA
+	def_bool y
+

Do you really want ZONE_DMA? Looking through the code it seems like you are just using this in place of ZONE_NORMAL instead of for dealing with any specific DMA limitations.

arch/tile/Kconfig line 31

Quoted 3 lines
arch/tile/Kconfig new file +3 -0
+config CC_OPTIMIZE_FOR_SIZE
+	def_bool y
+

This is a duplicate of the init/Kconfig entry. If you always want this enabled you can select it.

arch/tile/Kconfig line 52

Quoted 3 lines
arch/tile/Kconfig new file +3 -0
+config CLOCKSOURCE_WATCHDOG
+	def_bool y
+

Are you also sure that you want this? It doesn't seem like you have any of the clocksource stability issues that x86 does, so it's not obvious why you are enabling this.

arch/tile/Kconfig line 82

Quoted 6 lines
arch/tile/Kconfig new file +6 -0
+config ARCH_DISCONTIGMEM_ENABLE
+	def_bool y
+
+config ARCH_DISCONTIGMEM_DEFAULT
+	def_bool y
+

Have you considered sparsemem instead?

arch/tile/Kconfig line 92

Quoted 4 lines
arch/tile/Kconfig new file +4 -0
+# SMP is required for Tilera Linux.
+config SMP
+	def_bool y
+

Forcing on SMP is fairly unusual, you do not support booting UP kernels at all?

arch/tile/Kconfig line 102

Quoted 3 lines
arch/tile/Kconfig new file +3 -0
+config SERIAL_CONSOLE
+	def_bool y
+

This seems unused and looks like it was just copied over from some other architecture?

arch/tile/Kconfig line 113

Quoted 11 lines
arch/tile/Kconfig new file +11 -0
+config HVC_TILE
+	select HVC_DRIVER
+	def_bool y
+
+config TILE
+	def_bool y
+	select GENERIC_FIND_FIRST_BIT
+	select GENERIC_FIND_NEXT_BIT
+	select RESOURCES_64BIT
+	select USE_GENERIC_SMP_HELPERS
+

RESOURCES_64BIT is more legacy stuff, you don't need this anymore by virtue of the 64-bit phys_addr_t that you're already forcing on.

arch/tile/Kconfig line 330

Quoted 6 lines
arch/tile/Kconfig new file +6 -0
+menu "Bus options"
+
+config NO_IOMEM
+	bool
+	def_bool !PCI
+

Have you inverted the logic here? Judging from your I/O routines it's the PIO stuff you want disabled, not MMIO. As such, it's NO_IOPORT that you want. Some of the PCI drivers will still use inb/outb and friends for PCI IO space so disabling it for the !PCI case is fine.

#85 lore raw

Re: [PATCH 2/8] arch/tile: infrastructure and configuration-related files.

Quoted 10 lines · Paul Mundt

arch/tile/Kconfig line 25

Quoted 4 lines · Chris Metcalf
arch/tile/Kconfig new file +3 -0
+config ZONE_DMA
+	def_bool y
+

Do you really want ZONE_DMA? Looking through the code it seems like you are just using this in place of ZONE_NORMAL instead of for dealing with any specific DMA limitations.

Yes, this dates back to 2.6.18 or so, when I think you had to have it. In any case I've switched it over to ZONE_NORMAL throughout our code now, and it seems fine. Thanks.

Quoted 8 lines

arch/tile/Kconfig line 52

Quoted 4 lines
arch/tile/Kconfig new file +3 -0
+config CLOCKSOURCE_WATCHDOG
+	def_bool y
+

Are you also sure that you want this? It doesn't seem like you have any of the clocksource stability issues that x86 does, so it's not obvious why you are enabling this.

Ah, good catch. Thanks; I'm not sure where this config option came from, but it's gone now.

Quoted 9 lines

arch/tile/Kconfig line 82

Quoted 7 lines
arch/tile/Kconfig new file +6 -0
+config ARCH_DISCONTIGMEM_ENABLE
+	def_bool y
+
+config ARCH_DISCONTIGMEM_DEFAULT
+	def_bool y
+

Have you considered sparsemem instead?

I looked at both of them a while ago (2.6.18 or 2.6.26, not sure which), and at the time it seemed easier to do discontig. I vaguely recall there was some awkwardness with our architecture when I tried to figure out the sparsemem route. I filed a tracking bug on this issue internally so we can revisit it at some point.

Quoted 8 lines

arch/tile/Kconfig line 92

Quoted 5 lines
arch/tile/Kconfig new file +4 -0
+# SMP is required for Tilera Linux.
+config SMP
+	def_bool y
+

Forcing on SMP is fairly unusual, you do not support booting UP kernels at all?

We've written the code to try to support UP, but the couple of times we've tried to build with !SMP, there have been some subtle bugs. There's no reason we'd ever sell a chip with a single cpu on it (that I can see, anyway), so it's not very pressing to investigate failures in this mode, so it's disabled.

Quoted 7 lines

arch/tile/Kconfig line 102

Quoted 4 lines
arch/tile/Kconfig new file +3 -0
+config SERIAL_CONSOLE
+	def_bool y
+

This seems unused and looks like it was just copied over from some other architecture?

Thanks, good catch.

Quoted 12 lines

arch/tile/Kconfig line 330

Quoted 7 lines
arch/tile/Kconfig new file +6 -0
+menu "Bus options"
+
+config NO_IOMEM
+	bool
+	def_bool !PCI
+

Have you inverted the logic here? Judging from your I/O routines it's the PIO stuff you want disabled, not MMIO. As such, it's NO_IOPORT that you want. Some of the PCI drivers will still use inb/outb and friends for PCI IO space so disabling it for the !PCI case is fine.

If we don't have PCI, we don't have IOMEM, since our 32-bit chips don't support any kind of direct MMIO. I would also have set NO_IOPORT unconditionally, but it turns out some generic code (e.g. some IDE stuff) breaks in this case. At some point I'll investigate this in more detail, though probably only after we convert our GPIO-based ATA driver to not use IDE at all.

Thanks for your feedback! I'll put out a [PATCH 9/8] for now to hopefully wrap this first set of changes up, and I'm also going to get all this stuff into a GIT repository on kernel.org now that I have an account there.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#86 lore raw

PATCH 2/8 arch/tile: infrastructure and configuration-related files.

In reply to Chris Metcalf

This change updates MAINTAINERS and provides the top-level configuration and build files, and the default configuration.

---
 MAINTAINERS                      |    6 +
 arch/tile/Kbuild                 |    3 +
 arch/tile/Kconfig                |  360 +++++++++++
 arch/tile/Kconfig.debug          |   43 ++
 arch/tile/Makefile               |   52 ++
 arch/tile/configs/tile_defconfig | 1289 ++++++++++++++++++++++++++++++++++++++
 6 files changed, 1753 insertions(+), 0 deletions(-)
 create mode 100644 arch/tile/Kbuild
 create mode 100644 arch/tile/Kconfig
 create mode 100644 arch/tile/Kconfig.debug
 create mode 100644 arch/tile/Makefile
 create mode 100644 arch/tile/configs/tile_defconfig
MAINTAINERS +6 -0
index 8e01948..438bfe0 100644
@@ -5521,6 +5521,12 @@ F:	include/linux/tipc*.h
 F:	include/net/tipc/
 F:	net/tipc/
 
+TILE ARCHITECTURE
+M:	Chris Metcalf <[email protected]>
+W:	http://www.tilera.com/scm/
+S:	Supported
+F:	arch/tile/
+
 TLAN NETWORK DRIVER
 M:	Samuel Chessman <[email protected]>
 L:	[email protected] (subscribers-only)
arch/tile/Kbuild new file +3 -0
new file mode 100644
index 0000000..a9b9227
@@ -0,0 +1,3 @@
+
+obj-y += kernel/
+obj-y += mm/
arch/tile/Kconfig new file +360 -0

360 lines not on this page · raw message

arch/tile/Kconfig.debug new file +43 -0

43 lines not on this page · raw message

arch/tile/Makefile new file +52 -0

52 lines not on this page · raw message

arch/tile/configs/tile_defconfig new file +1289 -0

1,289 lines not on this page · raw message

Signature · 1 line
1.6.5.2
#87 lore raw

PATCH 3/8 arch/tile: header files for the Tile architecture.

In reply to Chris Metcalf

This includes the relevant Linux headers in asm/; the low-level low-level "Tile architecture" headers in arch/, which are shared with the hypervisor, etc., and are build-system agnostic; and the relevant hypervisor headers in hv/.

---
 arch/tile/include/arch/abi.h                |   93 ++
 arch/tile/include/arch/chip.h               |   23 +
 arch/tile/include/arch/chip_tile64.h        |  252 +++
 arch/tile/include/arch/chip_tilepro.h       |  252 +++
 arch/tile/include/arch/interrupts.h         |   19 +
 arch/tile/include/arch/interrupts_32.h      |  304 ++++
 arch/tile/include/arch/sim_def.h            |  512 ++++++
 arch/tile/include/arch/spr_def.h            |   19 +
 arch/tile/include/arch/spr_def_32.h         |  162 ++
 arch/tile/include/asm/Kbuild                |    3 +
 arch/tile/include/asm/asm-offsets.h         |    1 +
 arch/tile/include/asm/atomic.h              |  159 ++
 arch/tile/include/asm/atomic_32.h           |  353 ++++
 arch/tile/include/asm/auxvec.h              |   20 +
 arch/tile/include/asm/backtrace.h           |  193 +++
 arch/tile/include/asm/bitops.h              |  126 ++
 arch/tile/include/asm/bitops_32.h           |  132 ++
 arch/tile/include/asm/bitsperlong.h         |   26 +
 arch/tile/include/asm/bug.h                 |    1 +
 arch/tile/include/asm/bugs.h                |    1 +
 arch/tile/include/asm/byteorder.h           |    1 +
 arch/tile/include/asm/cache.h               |   50 +
 arch/tile/include/asm/cacheflush.h          |  145 ++
 arch/tile/include/asm/checksum.h            |   24 +
 arch/tile/include/asm/compat.h              |  308 ++++
 arch/tile/include/asm/cputime.h             |    1 +
 arch/tile/include/asm/current.h             |   31 +
 arch/tile/include/asm/delay.h               |   34 +
 arch/tile/include/asm/device.h              |    1 +
 arch/tile/include/asm/div64.h               |    1 +
 arch/tile/include/asm/dma-mapping.h         |  106 ++
 arch/tile/include/asm/dma.h                 |   25 +
 arch/tile/include/asm/elf.h                 |  169 ++
 arch/tile/include/asm/emergency-restart.h   |    1 +
 arch/tile/include/asm/errno.h               |    1 +
 arch/tile/include/asm/fcntl.h               |    1 +
 arch/tile/include/asm/fixmap.h              |  124 ++
 arch/tile/include/asm/ftrace.h              |   20 +
 arch/tile/include/asm/futex.h               |  136 ++
 arch/tile/include/asm/hardirq.h             |   47 +
 arch/tile/include/asm/highmem.h             |   73 +
 arch/tile/include/asm/homecache.h           |  125 ++
 arch/tile/include/asm/hugetlb.h             |  109 ++
 arch/tile/include/asm/hv_driver.h           |   60 +
 arch/tile/include/asm/hw_irq.h              |   18 +
 arch/tile/include/asm/ide.h                 |   25 +
 arch/tile/include/asm/io.h                  |  220 +++
 arch/tile/include/asm/ioctl.h               |    1 +
 arch/tile/include/asm/ioctls.h              |    1 +
 arch/tile/include/asm/ipc.h                 |    1 +
 arch/tile/include/asm/ipcbuf.h              |    1 +
 arch/tile/include/asm/irq.h                 |   37 +
 arch/tile/include/asm/irq_regs.h            |    1 +
 arch/tile/include/asm/irqflags.h            |  267 +++
 arch/tile/include/asm/kdebug.h              |    1 +
 arch/tile/include/asm/kexec.h               |   53 +
 arch/tile/include/asm/kmap_types.h          |   43 +
 arch/tile/include/asm/linkage.h             |   51 +
 arch/tile/include/asm/local.h               |    1 +
 arch/tile/include/asm/memprof.h             |   33 +
 arch/tile/include/asm/mman.h                |   40 +
 arch/tile/include/asm/mmu.h                 |   31 +
 arch/tile/include/asm/mmu_context.h         |  131 ++
 arch/tile/include/asm/mmzone.h              |   81 +
 arch/tile/include/asm/module.h              |    1 +
 arch/tile/include/asm/msgbuf.h              |    1 +
 arch/tile/include/asm/mutex.h               |    1 +
 arch/tile/include/asm/opcode-tile.h         |   30 +
 arch/tile/include/asm/opcode-tile_32.h      | 1597 ++++++++++++++++++
 arch/tile/include/asm/opcode-tile_64.h      | 1597 ++++++++++++++++++
 arch/tile/include/asm/opcode_constants.h    |   26 +
 arch/tile/include/asm/opcode_constants_32.h |  480 ++++++
 arch/tile/include/asm/opcode_constants_64.h |  480 ++++++
 arch/tile/include/asm/page.h                |  334 ++++
 arch/tile/include/asm/param.h               |    1 +
 arch/tile/include/asm/pci-bridge.h          |  117 ++
 arch/tile/include/asm/pci.h                 |  128 ++
 arch/tile/include/asm/percpu.h              |   24 +
 arch/tile/include/asm/pgalloc.h             |  119 ++
 arch/tile/include/asm/pgtable.h             |  475 ++++++
 arch/tile/include/asm/pgtable_32.h          |  117 ++
 arch/tile/include/asm/poll.h                |    1 +
 arch/tile/include/asm/posix_types.h         |    1 +
 arch/tile/include/asm/processor.h           |  339 ++++
 arch/tile/include/asm/ptrace.h              |  163 ++
 arch/tile/include/asm/resource.h            |    1 +
 arch/tile/include/asm/scatterlist.h         |    1 +
 arch/tile/include/asm/sections.h            |   37 +
 arch/tile/include/asm/sembuf.h              |    1 +
 arch/tile/include/asm/setup.h               |   32 +
 arch/tile/include/asm/shmbuf.h              |    1 +
 arch/tile/include/asm/shmparam.h            |    1 +
 arch/tile/include/asm/sigcontext.h          |   27 +
 arch/tile/include/asm/sigframe.h            |   33 +
 arch/tile/include/asm/siginfo.h             |   30 +
 arch/tile/include/asm/signal.h              |   31 +
 arch/tile/include/asm/smp.h                 |  126 ++
 arch/tile/include/asm/socket.h              |    1 +
 arch/tile/include/asm/sockios.h             |    1 +
 arch/tile/include/asm/spinlock.h            |   24 +
 arch/tile/include/asm/spinlock_32.h         |  200 +++
 arch/tile/include/asm/spinlock_types.h      |   60 +
 arch/tile/include/asm/stack.h               |   68 +
 arch/tile/include/asm/stat.h                |    1 +
 arch/tile/include/asm/statfs.h              |    1 +
 arch/tile/include/asm/string.h              |   32 +
 arch/tile/include/asm/swab.h                |   29 +
 arch/tile/include/asm/syscall.h             |   79 +
 arch/tile/include/asm/syscalls.h            |   60 +
 arch/tile/include/asm/system.h              |  220 +++
 arch/tile/include/asm/termbits.h            |    1 +
 arch/tile/include/asm/termios.h             |    1 +
 arch/tile/include/asm/thread_info.h         |  165 ++
 arch/tile/include/asm/timex.h               |   47 +
 arch/tile/include/asm/tlb.h                 |   25 +
 arch/tile/include/asm/tlbflush.h            |  128 ++
 arch/tile/include/asm/topology.h            |   85 +
 arch/tile/include/asm/traps.h               |   36 +
 arch/tile/include/asm/types.h               |    1 +
 arch/tile/include/asm/uaccess.h             |  578 +++++++
 arch/tile/include/asm/ucontext.h            |    1 +
 arch/tile/include/asm/unaligned.h           |   24 +
 arch/tile/include/asm/unistd.h              |   47 +
 arch/tile/include/asm/user.h                |   21 +
 arch/tile/include/asm/xor.h                 |    1 +
 arch/tile/include/hv/drv_pcie_rc_intf.h     |   38 +
 arch/tile/include/hv/hypervisor.h           | 2366 +++++++++++++++++++++++++++
 arch/tile/include/hv/syscall_public.h       |   42 +
 128 files changed, 16017 insertions(+), 0 deletions(-)
 create mode 100644 arch/tile/include/arch/abi.h
 create mode 100644 arch/tile/include/arch/chip.h
 create mode 100644 arch/tile/include/arch/chip_tile64.h
 create mode 100644 arch/tile/include/arch/chip_tilepro.h
 create mode 100644 arch/tile/include/arch/interrupts.h
 create mode 100644 arch/tile/include/arch/interrupts_32.h
 create mode 100644 arch/tile/include/arch/sim_def.h
 create mode 100644 arch/tile/include/arch/spr_def.h
 create mode 100644 arch/tile/include/arch/spr_def_32.h
 create mode 100644 arch/tile/include/asm/Kbuild
 create mode 100644 arch/tile/include/asm/asm-offsets.h
 create mode 100644 arch/tile/include/asm/atomic.h
 create mode 100644 arch/tile/include/asm/atomic_32.h
 create mode 100644 arch/tile/include/asm/auxvec.h
 create mode 100644 arch/tile/include/asm/backtrace.h
 create mode 100644 arch/tile/include/asm/bitops.h
 create mode 100644 arch/tile/include/asm/bitops_32.h
 create mode 100644 arch/tile/include/asm/bitsperlong.h
 create mode 100644 arch/tile/include/asm/bug.h
 create mode 100644 arch/tile/include/asm/bugs.h
 create mode 100644 arch/tile/include/asm/byteorder.h
 create mode 100644 arch/tile/include/asm/cache.h
 create mode 100644 arch/tile/include/asm/cacheflush.h
 create mode 100644 arch/tile/include/asm/checksum.h
 create mode 100644 arch/tile/include/asm/compat.h
 create mode 100644 arch/tile/include/asm/cputime.h
 create mode 100644 arch/tile/include/asm/current.h
 create mode 100644 arch/tile/include/asm/delay.h
 create mode 100644 arch/tile/include/asm/device.h
 create mode 100644 arch/tile/include/asm/div64.h
 create mode 100644 arch/tile/include/asm/dma-mapping.h
 create mode 100644 arch/tile/include/asm/dma.h
 create mode 100644 arch/tile/include/asm/elf.h
 create mode 100644 arch/tile/include/asm/emergency-restart.h
 create mode 100644 arch/tile/include/asm/errno.h
 create mode 100644 arch/tile/include/asm/fcntl.h
 create mode 100644 arch/tile/include/asm/fixmap.h
 create mode 100644 arch/tile/include/asm/ftrace.h
 create mode 100644 arch/tile/include/asm/futex.h
 create mode 100644 arch/tile/include/asm/hardirq.h
 create mode 100644 arch/tile/include/asm/highmem.h
 create mode 100644 arch/tile/include/asm/homecache.h
 create mode 100644 arch/tile/include/asm/hugetlb.h
 create mode 100644 arch/tile/include/asm/hv_driver.h
 create mode 100644 arch/tile/include/asm/hw_irq.h
 create mode 100644 arch/tile/include/asm/ide.h
 create mode 100644 arch/tile/include/asm/io.h
 create mode 100644 arch/tile/include/asm/ioctl.h
 create mode 100644 arch/tile/include/asm/ioctls.h
 create mode 100644 arch/tile/include/asm/ipc.h
 create mode 100644 arch/tile/include/asm/ipcbuf.h
 create mode 100644 arch/tile/include/asm/irq.h
 create mode 100644 arch/tile/include/asm/irq_regs.h
 create mode 100644 arch/tile/include/asm/irqflags.h
 create mode 100644 arch/tile/include/asm/kdebug.h
 create mode 100644 arch/tile/include/asm/kexec.h
 create mode 100644 arch/tile/include/asm/kmap_types.h
 create mode 100644 arch/tile/include/asm/linkage.h
 create mode 100644 arch/tile/include/asm/local.h
 create mode 100644 arch/tile/include/asm/memprof.h
 create mode 100644 arch/tile/include/asm/mman.h
 create mode 100644 arch/tile/include/asm/mmu.h
 create mode 100644 arch/tile/include/asm/mmu_context.h
 create mode 100644 arch/tile/include/asm/mmzone.h
 create mode 100644 arch/tile/include/asm/module.h
 create mode 100644 arch/tile/include/asm/msgbuf.h
 create mode 100644 arch/tile/include/asm/mutex.h
 create mode 100644 arch/tile/include/asm/opcode-tile.h
 create mode 100644 arch/tile/include/asm/opcode-tile_32.h
 create mode 100644 arch/tile/include/asm/opcode-tile_64.h
 create mode 100644 arch/tile/include/asm/opcode_constants.h
 create mode 100644 arch/tile/include/asm/opcode_constants_32.h
 create mode 100644 arch/tile/include/asm/opcode_constants_64.h
 create mode 100644 arch/tile/include/asm/page.h
 create mode 100644 arch/tile/include/asm/param.h
 create mode 100644 arch/tile/include/asm/pci-bridge.h
 create mode 100644 arch/tile/include/asm/pci.h
 create mode 100644 arch/tile/include/asm/percpu.h
 create mode 100644 arch/tile/include/asm/pgalloc.h
 create mode 100644 arch/tile/include/asm/pgtable.h
 create mode 100644 arch/tile/include/asm/pgtable_32.h
 create mode 100644 arch/tile/include/asm/poll.h
 create mode 100644 arch/tile/include/asm/posix_types.h
 create mode 100644 arch/tile/include/asm/processor.h
 create mode 100644 arch/tile/include/asm/ptrace.h
 create mode 100644 arch/tile/include/asm/resource.h
 create mode 100644 arch/tile/include/asm/scatterlist.h
 create mode 100644 arch/tile/include/asm/sections.h
 create mode 100644 arch/tile/include/asm/sembuf.h
 create mode 100644 arch/tile/include/asm/setup.h
 create mode 100644 arch/tile/include/asm/shmbuf.h
 create mode 100644 arch/tile/include/asm/shmparam.h
 create mode 100644 arch/tile/include/asm/sigcontext.h
 create mode 100644 arch/tile/include/asm/sigframe.h
 create mode 100644 arch/tile/include/asm/siginfo.h
 create mode 100644 arch/tile/include/asm/signal.h
 create mode 100644 arch/tile/include/asm/smp.h
 create mode 100644 arch/tile/include/asm/socket.h
 create mode 100644 arch/tile/include/asm/sockios.h
 create mode 100644 arch/tile/include/asm/spinlock.h
 create mode 100644 arch/tile/include/asm/spinlock_32.h
 create mode 100644 arch/tile/include/asm/spinlock_types.h
 create mode 100644 arch/tile/include/asm/stack.h
 create mode 100644 arch/tile/include/asm/stat.h
 create mode 100644 arch/tile/include/asm/statfs.h
 create mode 100644 arch/tile/include/asm/string.h
 create mode 100644 arch/tile/include/asm/swab.h
 create mode 100644 arch/tile/include/asm/syscall.h
 create mode 100644 arch/tile/include/asm/syscalls.h
 create mode 100644 arch/tile/include/asm/system.h
 create mode 100644 arch/tile/include/asm/termbits.h
 create mode 100644 arch/tile/include/asm/termios.h
 create mode 100644 arch/tile/include/asm/thread_info.h
 create mode 100644 arch/tile/include/asm/timex.h
 create mode 100644 arch/tile/include/asm/tlb.h
 create mode 100644 arch/tile/include/asm/tlbflush.h
 create mode 100644 arch/tile/include/asm/topology.h
 create mode 100644 arch/tile/include/asm/traps.h
 create mode 100644 arch/tile/include/asm/types.h
 create mode 100644 arch/tile/include/asm/uaccess.h
 create mode 100644 arch/tile/include/asm/ucontext.h
 create mode 100644 arch/tile/include/asm/unaligned.h
 create mode 100644 arch/tile/include/asm/unistd.h
 create mode 100644 arch/tile/include/asm/user.h
 create mode 100644 arch/tile/include/asm/xor.h
 create mode 100644 arch/tile/include/hv/drv_pcie_rc_intf.h
 create mode 100644 arch/tile/include/hv/hypervisor.h
 create mode 100644 arch/tile/include/hv/syscall_public.h
arch/tile/include/arch/abi.h new file +93 -0
new file mode 100644
index 0000000..7cdc47b
@@ -0,0 +1,93 @@
+// Copyright 2010 Tilera Corporation. All Rights Reserved.
+//
+//   This program is free software; you can redistribute it and/or
+//   modify it under the terms of the GNU General Public License
+//   as published by the Free Software Foundation, version 2.
+//
+//   This program is distributed in the hope that it will be useful, but
+//   WITHOUT ANY WARRANTY; without even the implied warranty of
+//   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+//   NON INFRINGEMENT.  See the GNU General Public License for
+//   more details.
+
+//! @file
+//!
+//! ABI-related register definitions helpful when writing assembly code.
+//!
+
+#ifndef __ARCH_ABI_H__
+#define __ARCH_ABI_H__
+
+#include <arch/chip.h>
+
+// Registers 0 - 55 are "normal", but some perform special roles.
+
+#define TREG_FP       52   /**< Frame pointer. */
+#define TREG_TP       53   /**< Thread pointer. */
+#define TREG_SP       54   /**< Stack pointer. */
+#define TREG_LR       55   /**< Link to calling function PC. */
+
+/** Index of last normal general-purpose register. */
+#define TREG_LAST_GPR 55
+
+// Registers 56 - 62 are "special" network registers.
+
+#define TREG_SN       56   /**< Static network access. */
+#define TREG_IDN0     57   /**< IDN demux 0 access. */
+#define TREG_IDN1     58   /**< IDN demux 1 access. */
+#define TREG_UDN0     59   /**< UDN demux 0 access. */
+#define TREG_UDN1     60   /**< UDN demux 1 access. */
+#define TREG_UDN2     61   /**< UDN demux 2 access. */
+#define TREG_UDN3     62   /**< UDN demux 3 access. */
+
+// Register 63 is the "special" zero register.
+
+#define TREG_ZERO     63   /**< "Zero" register; always reads as "0". */
+
+
+/** By convention, this register is used to hold the syscall number. */
+#define TREG_SYSCALL_NR      10
+
+/** Name of register that holds the syscall number, for use in assembly. */
+#define TREG_SYSCALL_NR_NAME r10
+
+
+//! The ABI requires callers to allocate a caller state save area of
+//! this many bytes at the bottom of each stack frame.
+//!
+#ifdef __tile__
+#define C_ABI_SAVE_AREA_SIZE (2 * __SIZEOF_POINTER__)
+#endif
+
+//! The operand to an 'info' opcode directing the backtracer to not
+//! try to find the calling frame.
+//!
+#define INFO_OP_CANNOT_BACKTRACE 2
+
+#ifndef __ASSEMBLER__
+#if CHIP_WORD_SIZE() > 32
+
+//! Unsigned type that can hold a register.
+typedef unsigned long long uint_reg_t;
+
+//! Signed type that can hold a register.
+typedef long long int_reg_t;
+
+//! String prefix to use for printf().
+#define INT_REG_FMT "ll"
+
+#elif !defined(__LP64__)   /* avoid confusion with LP64 cross-build tools */
+
+//! Unsigned type that can hold a register.
+typedef unsigned long uint_reg_t;
+
+//! Signed type that can hold a register.
+typedef long int_reg_t;
+
+//! String prefix to use for printf().
+#define INT_REG_FMT "l"
+
+#endif
+#endif /* __ASSEMBLER__ */
+
+#endif // !__ARCH_ABI_H__
arch/tile/include/arch/chip.h new file +23 -0
new file mode 100644
index 0000000..926d3db
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2010 Tilera Corporation. All Rights Reserved.
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation, version 2.
+ *
+ *   This program is distributed in the hope that it will be useful, but
+ *   WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ *   NON INFRINGEMENT.  See the GNU General Public License for
+ *   more details.
+ */
+
+#if __tile_chip__ == 0
+#include <arch/chip_tile64.h>
+#elif __tile_chip__ == 1
+#include <arch/chip_tilepro.h>
+#elif defined(__tilegx__)
+#include <arch/chip_tilegx.h>
+#else
+#error Unexpected Tilera chip type
+#endif
arch/tile/include/arch/chip_tile64.h new file +252 -0

252 lines not on this page · raw message

arch/tile/include/arch/chip_tilepro.h new file +252 -0

252 lines not on this page · raw message

arch/tile/include/arch/interrupts.h new file +19 -0
new file mode 100644
index 0000000..20f8f07
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2010 Tilera Corporation. All Rights Reserved.
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation, version 2.
+ *
+ *   This program is distributed in the hope that it will be useful, but
+ *   WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ *   NON INFRINGEMENT.  See the GNU General Public License for
+ *   more details.
+ */
+
+#ifdef __tilegx__
+#include <arch/interrupts_64.h>
+#else
+#include <arch/interrupts_32.h>
+#endif
arch/tile/include/arch/interrupts_32.h new file +304 -0

304 lines not on this page · raw message

arch/tile/include/arch/sim_def.h new file +512 -0

512 lines not on this page · raw message

arch/tile/include/arch/spr_def.h new file +19 -0
new file mode 100644
index 0000000..c8fdbd9
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2010 Tilera Corporation. All Rights Reserved.
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation, version 2.
+ *
+ *   This program is distributed in the hope that it will be useful, but
+ *   WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ *   NON INFRINGEMENT.  See the GNU General Public License for
+ *   more details.
+ */
+
+#ifdef __tilegx__
+#include <arch/spr_def_64.h>
+#else
+#include <arch/spr_def_32.h>
+#endif
arch/tile/include/arch/spr_def_32.h new file +162 -0

162 lines not on this page · raw message

arch/tile/include/asm/Kbuild new file +3 -0
new file mode 100644
index 0000000..3b8f55b
@@ -0,0 +1,3 @@
+include include/asm-generic/Kbuild.asm
+
+header-y += ucontext.h
arch/tile/include/asm/asm-offsets.h new file +1 -0
new file mode 100644
index 0000000..d370ee3
@@ -0,0 +1 @@
+#include <generated/asm-offsets.h>
arch/tile/include/asm/atomic.h new file +159 -0

159 lines not on this page · raw message

arch/tile/include/asm/atomic_32.h new file +353 -0

353 lines not on this page · raw message

arch/tile/include/asm/auxvec.h new file +20 -0
new file mode 100644
index 0000000..1d393ed
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2010 Tilera Corporation. All Rights Reserved.
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation, version 2.
+ *
+ *   This program is distributed in the hope that it will be useful, but
+ *   WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ *   NON INFRINGEMENT.  See the GNU General Public License for
+ *   more details.
+ */
+
+#ifndef _ASM_TILE_AUXVEC_H
+#define _ASM_TILE_AUXVEC_H
+
+/* No extensions to auxvec */
+
+#endif /* _ASM_TILE_AUXVEC_H */
arch/tile/include/asm/backtrace.h new file +193 -0

193 lines not on this page · raw message

arch/tile/include/asm/bitops.h new file +126 -0

126 lines not on this page · raw message

arch/tile/include/asm/bitops_32.h new file +132 -0

132 lines not on this page · raw message

arch/tile/include/asm/bitsperlong.h new file +26 -0
new file mode 100644
index 0000000..58c771f
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2010 Tilera Corporation. All Rights Reserved.
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation, version 2.
+ *
+ *   This program is distributed in the hope that it will be useful, but
+ *   WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ *   NON INFRINGEMENT.  See the GNU General Public License for
+ *   more details.
+ */
+
+#ifndef _ASM_TILE_BITSPERLONG_H
+#define _ASM_TILE_BITSPERLONG_H
+
+#ifdef __LP64__
+# define __BITS_PER_LONG 64
+#else
+# define __BITS_PER_LONG 32
+#endif
+
+#include <asm-generic/bitsperlong.h>
+
+#endif /* _ASM_TILE_BITSPERLONG_H */
arch/tile/include/asm/bug.h new file +1 -0
new file mode 100644
index 0000000..b12fd89
@@ -0,0 +1 @@
+#include <asm-generic/bug.h>
arch/tile/include/asm/bugs.h new file +1 -0
new file mode 100644
index 0000000..61791e1
@@ -0,0 +1 @@
+#include <asm-generic/bugs.h>
arch/tile/include/asm/byteorder.h new file +1 -0
new file mode 100644
index 0000000..9558416
@@ -0,0 +1 @@
+#include <linux/byteorder/little_endian.h>
arch/tile/include/asm/cache.h new file +50 -0

50 lines not on this page · raw message

arch/tile/include/asm/cacheflush.h new file +145 -0

145 lines not on this page · raw message

arch/tile/include/asm/checksum.h new file +24 -0
new file mode 100644
index 0000000..a120766
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2010 Tilera Corporation. All Rights Reserved.
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation, version 2.
+ *
+ *   This program is distributed in the hope that it will be useful, but
+ *   WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ *   NON INFRINGEMENT.  See the GNU General Public License for
+ *   more details.
+ */
+
+#ifndef _ASM_TILE_CHECKSUM_H
+#define _ASM_TILE_CHECKSUM_H
+
+#include <asm-generic/checksum.h>
+
+/* Allow us to provide a more optimized do_csum(). */
+__wsum do_csum(const unsigned char *buff, int len);
+#define do_csum do_csum
+
+#endif /* _ASM_TILE_CHECKSUM_H */
arch/tile/include/asm/compat.h new file +308 -0

129 lines not on this page · raw message

arch/tile/include/asm/cputime.h new file +1 -0
new file mode 100644
index 0000000..6d68ad7

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/current.h new file +31 -0
new file mode 100644
index 0000000..da21acf

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/delay.h new file +34 -0
new file mode 100644
index 0000000..97b0e69

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/device.h new file +1 -0
new file mode 100644
index 0000000..f0a4c25

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/div64.h new file +1 -0
new file mode 100644
index 0000000..6cd978c

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/dma-mapping.h new file +106 -0

106 lines not on this page · raw message

arch/tile/include/asm/dma.h new file +25 -0
new file mode 100644
index 0000000..12a7ca1

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/elf.h new file +169 -0

169 lines not on this page · raw message

arch/tile/include/asm/emergency-restart.h new file +1 -0
new file mode 100644
index 0000000..3711bd9

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/errno.h new file +1 -0
new file mode 100644
index 0000000..4c82b50

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/fcntl.h new file +1 -0
new file mode 100644
index 0000000..46ab12d

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/fixmap.h new file +124 -0

124 lines not on this page · raw message

arch/tile/include/asm/ftrace.h new file +20 -0
new file mode 100644
index 0000000..461459b

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/futex.h new file +136 -0

136 lines not on this page · raw message

arch/tile/include/asm/hardirq.h new file +47 -0

47 lines not on this page · raw message

arch/tile/include/asm/highmem.h new file +73 -0

73 lines not on this page · raw message

arch/tile/include/asm/homecache.h new file +125 -0

125 lines not on this page · raw message

arch/tile/include/asm/hugetlb.h new file +109 -0

109 lines not on this page · raw message

arch/tile/include/asm/hv_driver.h new file +60 -0

60 lines not on this page · raw message

arch/tile/include/asm/hw_irq.h new file +18 -0
new file mode 100644
index 0000000..4fac5fb

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/ide.h new file +25 -0
new file mode 100644
index 0000000..3c6f2ed

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/io.h new file +220 -0

220 lines not on this page · raw message

arch/tile/include/asm/ioctl.h new file +1 -0
new file mode 100644
index 0000000..b279fe0

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/ioctls.h new file +1 -0
new file mode 100644
index 0000000..ec34c76

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/ipc.h new file +1 -0
new file mode 100644
index 0000000..a46e3d9

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/ipcbuf.h new file +1 -0
new file mode 100644
index 0000000..84c7e51

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/irq.h new file +37 -0
new file mode 100644
index 0000000..9be1f84

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/irq_regs.h new file +1 -0
new file mode 100644
index 0000000..3dd9c0b

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/irqflags.h new file +267 -0

267 lines not on this page · raw message

arch/tile/include/asm/kdebug.h new file +1 -0
new file mode 100644
index 0000000..6ece1b0

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/kexec.h new file +53 -0

53 lines not on this page · raw message

arch/tile/include/asm/kmap_types.h new file +43 -0

43 lines not on this page · raw message

arch/tile/include/asm/linkage.h new file +51 -0

51 lines not on this page · raw message

arch/tile/include/asm/local.h new file +1 -0
new file mode 100644
index 0000000..c11c530

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/memprof.h new file +33 -0
new file mode 100644
index 0000000..359949b

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/mman.h new file +40 -0
new file mode 100644
index 0000000..4c6811e

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/mmu.h new file +31 -0
new file mode 100644
index 0000000..92f94c7

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/mmu_context.h new file +131 -0

131 lines not on this page · raw message

arch/tile/include/asm/mmzone.h new file +81 -0

81 lines not on this page · raw message

arch/tile/include/asm/module.h new file +1 -0
new file mode 100644
index 0000000..1e4b79f

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/msgbuf.h new file +1 -0
new file mode 100644
index 0000000..809134c

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/mutex.h new file +1 -0
new file mode 100644
index 0000000..ff6101a

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/opcode-tile.h new file +30 -0
new file mode 100644
index 0000000..ba38959

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/opcode-tile_32.h new file +1597 -0

1,597 lines not on this page · raw message

arch/tile/include/asm/opcode-tile_64.h new file +1597 -0

1,597 lines not on this page · raw message

arch/tile/include/asm/opcode_constants.h new file +26 -0
new file mode 100644
index 0000000..37a9f29

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/opcode_constants_32.h new file +480 -0

480 lines not on this page · raw message

arch/tile/include/asm/opcode_constants_64.h new file +480 -0

480 lines not on this page · raw message

arch/tile/include/asm/page.h new file +334 -0

334 lines not on this page · raw message

arch/tile/include/asm/param.h new file +1 -0
new file mode 100644
index 0000000..965d454

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/pci-bridge.h new file +117 -0

117 lines not on this page · raw message

arch/tile/include/asm/pci.h new file +128 -0

128 lines not on this page · raw message

arch/tile/include/asm/percpu.h new file +24 -0
new file mode 100644
index 0000000..63294f5

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/pgalloc.h new file +119 -0

119 lines not on this page · raw message

arch/tile/include/asm/pgtable.h new file +475 -0

475 lines not on this page · raw message

arch/tile/include/asm/pgtable_32.h new file +117 -0

117 lines not on this page · raw message

arch/tile/include/asm/poll.h new file +1 -0
new file mode 100644
index 0000000..c98509d

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/posix_types.h new file +1 -0
new file mode 100644
index 0000000..22cae62

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/processor.h new file +339 -0

339 lines not on this page · raw message

arch/tile/include/asm/ptrace.h new file +163 -0

163 lines not on this page · raw message

arch/tile/include/asm/resource.h new file +1 -0
new file mode 100644
index 0000000..04bc4db

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/scatterlist.h new file +1 -0
new file mode 100644
index 0000000..35d786f

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/sections.h new file +37 -0
new file mode 100644
index 0000000..6c11149

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/sembuf.h new file +1 -0
new file mode 100644
index 0000000..7673b83

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/setup.h new file +32 -0
new file mode 100644
index 0000000..823ddd4

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/shmbuf.h new file +1 -0
new file mode 100644
index 0000000..83c05fc

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/shmparam.h new file +1 -0
new file mode 100644
index 0000000..93f30de

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/sigcontext.h new file +27 -0
new file mode 100644
index 0000000..7cd7672

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/sigframe.h new file +33 -0
new file mode 100644
index 0000000..994d3d3

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/siginfo.h new file +30 -0
new file mode 100644
index 0000000..0c12d1b

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/signal.h new file +31 -0
new file mode 100644
index 0000000..d20d326

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/smp.h new file +126 -0

126 lines not on this page · raw message

arch/tile/include/asm/socket.h new file +1 -0
new file mode 100644
index 0000000..6b71384

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/sockios.h new file +1 -0
new file mode 100644
index 0000000..def6d47

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/spinlock.h new file +24 -0
new file mode 100644
index 0000000..1a8bd47

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/spinlock_32.h new file +200 -0

200 lines not on this page · raw message

arch/tile/include/asm/spinlock_types.h new file +60 -0

60 lines not on this page · raw message

arch/tile/include/asm/stack.h new file +68 -0

68 lines not on this page · raw message

arch/tile/include/asm/stat.h new file +1 -0
new file mode 100644
index 0000000..3dc90fa

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/statfs.h new file +1 -0
new file mode 100644
index 0000000..0b91fe1

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/string.h new file +32 -0
new file mode 100644
index 0000000..7535cf1

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/swab.h new file +29 -0
new file mode 100644
index 0000000..25c686a

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/syscall.h new file +79 -0

79 lines not on this page · raw message

arch/tile/include/asm/syscalls.h new file +60 -0

60 lines not on this page · raw message

arch/tile/include/asm/system.h new file +220 -0

220 lines not on this page · raw message

arch/tile/include/asm/termbits.h new file +1 -0
new file mode 100644
index 0000000..3935b10

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/termios.h new file +1 -0
new file mode 100644
index 0000000..280d78a

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/thread_info.h new file +165 -0

165 lines not on this page · raw message

arch/tile/include/asm/timex.h new file +47 -0

47 lines not on this page · raw message

arch/tile/include/asm/tlb.h new file +25 -0
new file mode 100644
index 0000000..4a891a1

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/tlbflush.h new file +128 -0

128 lines not on this page · raw message

arch/tile/include/asm/topology.h new file +85 -0

85 lines not on this page · raw message

arch/tile/include/asm/traps.h new file +36 -0
new file mode 100644
index 0000000..eab33d4

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/types.h new file +1 -0
new file mode 100644
index 0000000..b9e79bc

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/uaccess.h new file +578 -0

578 lines not on this page · raw message

arch/tile/include/asm/ucontext.h new file +1 -0
new file mode 100644
index 0000000..9bc07b9

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/unaligned.h new file +24 -0
new file mode 100644
index 0000000..137e2de

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/unistd.h new file +47 -0

47 lines not on this page · raw message

arch/tile/include/asm/user.h new file +21 -0
new file mode 100644
index 0000000..cbc8b4d

Lines of this file are not shown. View the raw message.

arch/tile/include/asm/xor.h new file +1 -0
new file mode 100644
index 0000000..c82eb12

Lines of this file are not shown. View the raw message.

arch/tile/include/hv/drv_pcie_rc_intf.h new file +38 -0
new file mode 100644
index 0000000..9bd2243

Lines of this file are not shown. View the raw message.

arch/tile/include/hv/hypervisor.h new file +2366 -0

2,366 lines not on this page · raw message

arch/tile/include/hv/syscall_public.h new file +42 -0

42 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.6.5.2

Part of the diff is not shown here. View the raw message.

#88 lore raw

Re: [PATCH 3/8] arch/tile: header files for the Tile architecture.

Quoted 6 lines · On Fri, 28 May 2010 23:10:07 -0400 Chris Metcalf <[email protected]> wrote:

This includes the relevant Linux headers in asm/; the low-level low-level "Tile architecture" headers in arch/, which are shared with the hypervisor, etc., and are build-system agnostic; and the relevant hypervisor headers in hv/.

(snip)

Quoted 13 lines

+++ b/arch/tile/include/asm/dma-mapping.h

arch/tile/include/asm/dma-mapping.h new file +11 -0
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2010 Tilera Corporation. All Rights Reserved.
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation, version 2.
+ *
+ *   This program is distributed in the hope that it will be useful, but
+ *   WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ *   NON INFRINGEMENT.  See the GNU General Public License for

arch/tile/include/asm/dma-mapping.h line 21

Quoted 10 lines
arch/tile/include/asm/dma-mapping.h new file +10 -0
+ *   more details.
+ */
+
+#ifndef _ASM_TILE_DMA_MAPPING_H
+#define _ASM_TILE_DMA_MAPPING_H
+
+/*
+ * IOMMU interface. See Documentation/PCI/PCI-DMA-mapping.txt and
+ * Documentation/DMA-API.txt for documentation.
+ */

Documentation/PCI/PCI-DMA-mapping.txt was renamed to Documentation/DMA-API-HOWTO. Anyway, I recommend removing the useless comment.

arch/tile/include/asm/dma-mapping.h line 32

Quoted 10 lines
arch/tile/include/asm/dma-mapping.h new file +10 -0
+#include <linux/mm.h>
+#include <linux/scatterlist.h>
+#include <linux/cache.h>
+#include <linux/io.h>
+
+/*
+ * Note that on x86 and powerpc, there is a "struct dma_mapping_ops"
+ * that is used for all the DMA operations.  For now, we don't have an
+ * equivalent on tile, because we only have a single way of doing DMA.
+ */

I think that using "struct dma_mapping_ops" is a good idea even if you support the single dma ops. You can avoid lots of duplicated code.

(snip)

arch/tile/include/asm/scatterlist.h line 1

Quoted 5 lines
(quoted diff) +0 -1
--- /dev/null
arch/tile/include/asm/scatterlist.h new file +1 -0
@@ -0,0 +1 @@
+#include <asm-generic/scatterlist.h>

Did you compile this patchset with 2.6.35-rc1? I think that you need to define ISA_DMA_THRESHOLD here.

#89 lore raw

PATCH 1/1 arch/tile: respond to reviews of the second code submission.

In reply to Chris Metcalf

This change addresses DMA-related comments by FUJITA Tomonori <[email protected]> and Kconfig-related comments by Paul Mundt <[email protected]>.

---
 arch/tile/Kconfig                   |   20 +++-------
 arch/tile/include/asm/dma-mapping.h |    6 +---
 arch/tile/include/asm/io.h          |   65 +++++++++++++++++++++++++++++++++--
 arch/tile/include/asm/scatterlist.h |   21 +++++++++++
 arch/tile/kernel/pci-dma.c          |   23 +++++++-----
 arch/tile/kernel/setup.c            |    8 ++--
 arch/tile/mm/init.c                 |    2 +-
 7 files changed, 108 insertions(+), 37 deletions(-)
arch/tile/Kconfig +6 -14
index b311484..290ef41 100644
@@ -20,15 +20,9 @@ config GENERIC_PENDING_IRQ
 	def_bool y
 	depends on GENERIC_HARDIRQS && SMP
 
-config ZONE_DMA
-	def_bool y
-
 config SEMAPHORE_SLEEPERS
 	def_bool y
 
-config CC_OPTIMIZE_FOR_SIZE
-	def_bool y
-
 config HAVE_ARCH_ALLOC_REMAP
 	def_bool y
 
@@ -47,9 +41,6 @@ config GENERIC_TIME
 config GENERIC_CLOCKEVENTS
 	def_bool y
 
-config CLOCKSOURCE_WATCHDOG
-	def_bool y
-
 # FIXME: tilegx can implement a more efficent rwsem.
 config RWSEM_GENERIC_SPINLOCK
 	def_bool y
@@ -74,6 +65,8 @@ config STACKTRACE_SUPPORT
 	def_bool y
 	select STACKTRACE
 
+# We use discontigmem for now; at some point we may want to switch
+# to sparsemem (Tilera bug 7996).
 config ARCH_DISCONTIGMEM_ENABLE
 	def_bool y
 
@@ -97,9 +90,6 @@ config SMP
 config DEBUG_COPY_FROM_USER
 	def_bool n
 
-config SERIAL_CONSOLE
-	def_bool y
-
 config HVC_TILE
 	select HVC_DRIVER
 	def_bool y
@@ -108,8 +98,8 @@ config TILE
 	def_bool y
 	select GENERIC_FIND_FIRST_BIT
 	select GENERIC_FIND_NEXT_BIT
-	select RESOURCES_64BIT
 	select USE_GENERIC_SMP_HELPERS
+	select CC_OPTIMIZE_FOR_SIZE
 
 # FIXME: investigate whether we need/want these options.
 #	select HAVE_IOREMAP_PROT
@@ -325,7 +315,9 @@ endmenu  # Tilera-specific configuration
 menu "Bus options"
 
 config NO_IOMEM
-	bool
+	def_bool !PCI
+
+config NO_IOPORT
 	def_bool !PCI
 
 source "drivers/pci/Kconfig"
arch/tile/include/asm/dma-mapping.h +1 -5
index 7083e42..cf466b3 100644
@@ -15,11 +15,6 @@
 #ifndef _ASM_TILE_DMA_MAPPING_H
 #define _ASM_TILE_DMA_MAPPING_H
 
-/*
- * IOMMU interface. See Documentation/PCI/PCI-DMA-mapping.txt and
- * Documentation/DMA-API.txt for documentation.
- */
-
 #include <linux/mm.h>
 #include <linux/scatterlist.h>
 #include <linux/cache.h>
@@ -29,6 +24,7 @@
  * Note that on x86 and powerpc, there is a "struct dma_mapping_ops"
  * that is used for all the DMA operations.  For now, we don't have an
  * equivalent on tile, because we only have a single way of doing DMA.
+ * (Tilera bug 7994 to use dma_mapping_ops.)
  */
 
 #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
arch/tile/include/asm/io.h +62 -3

83 lines not on this page · raw message

arch/tile/include/asm/scatterlist.h +21 -0
index 35d786f..c560424 100644
@@ -1 +1,22 @@
+/*
+ * Copyright 2010 Tilera Corporation. All Rights Reserved.
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation, version 2.
+ *
+ *   This program is distributed in the hope that it will be useful, but
+ *   WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ *   NON INFRINGEMENT.  See the GNU General Public License for
+ *   more details.
+ */
+
+#ifndef _ASM_TILE_SCATTERLIST_H
+#define _ASM_TILE_SCATTERLIST_H
+
+#define ISA_DMA_THRESHOLD	(~0UL)
+
 #include <asm-generic/scatterlist.h>
+
+#endif /* _ASM_TILE_SCATTERLIST_H */
arch/tile/kernel/pci-dma.c +13 -10
index b1ddc80..ed52447 100644
@@ -112,19 +112,20 @@ void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
 }
 EXPORT_SYMBOL(dma_unmap_single);
 
-int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
+int dma_map_sg(struct device *dev, struct scatterlist *sglist, int nents,
 	   enum dma_data_direction direction)
 {
+	struct scatterlist *sg;
 	int i;
 
 	BUG_ON(!valid_dma_direction(direction));
 
-	WARN_ON(nents == 0 || sg[0].length == 0);
+	WARN_ON(nents == 0 || sglist->length == 0);
 
-	for (i = 0; i < nents; i++) {
+	for_each_sg(sglist, sg, nents, i) {
 		struct page *page;
-		sg[i].dma_address = sg_phys(sg + i);
-		page = pfn_to_page(sg[i].dma_address >> PAGE_SHIFT);
+		sg->dma_address = sg_phys(sg);
+		page = pfn_to_page(sg->dma_address >> PAGE_SHIFT);
 		homecache_flush_cache(page, 0);
 	}
 
@@ -189,17 +190,19 @@ EXPORT_SYMBOL(dma_sync_sg_for_cpu);
 /*
  * Flush and invalidate cache for scatterlist.
  */
-void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
+void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sglist,
 			    int nelems, enum dma_data_direction direction)
 {
+	struct scatterlist *sg;
 	int i;
 
 	BUG_ON(!valid_dma_direction(direction));
-	WARN_ON(nelems == 0 || sg[0].length == 0);
+	WARN_ON(nelems == 0 || sglist->length == 0);
 
-	for (i = 0; i < nelems; i++)
-		dma_sync_single_for_device(dev, sg[i].dma_address,
-					   sg[i].dma_length, direction);
+	for_each_sg(sglist, sg, nelems, i) {
+		dma_sync_single_for_device(dev, sg->dma_address,
+					   sg_dma_len(sg), direction);
+	}
 }
 EXPORT_SYMBOL(dma_sync_sg_for_device);
 
arch/tile/kernel/setup.c +4 -4
index 333262d..934136b 100644
@@ -653,14 +653,14 @@ static void __init zone_sizes_init(void)
 
 #ifdef CONFIG_HIGHMEM
 		if (start > lowmem_end) {
-			zones_size[ZONE_DMA] = 0;
+			zones_size[ZONE_NORMAL] = 0;
 			zones_size[ZONE_HIGHMEM] = end - start;
 		} else {
-			zones_size[ZONE_DMA] = lowmem_end - start;
+			zones_size[ZONE_NORMAL] = lowmem_end - start;
 			zones_size[ZONE_HIGHMEM] = end - lowmem_end;
 		}
 #else
-		zones_size[ZONE_DMA] = end - start;
+		zones_size[ZONE_NORMAL] = end - start;
 #endif
 
 		/*
@@ -679,7 +679,7 @@ static void __init zone_sizes_init(void)
 		       PFN_UP(node_percpu[i]));
 
 		/* Track the type of memory on each node */
-		if (zones_size[ZONE_DMA])
+		if (zones_size[ZONE_NORMAL])
 			node_set_state(i, N_NORMAL_MEMORY);
 #ifdef CONFIG_HIGHMEM
 		if (end != start)
arch/tile/mm/init.c +1 -1
index 31b5c09..125ac53 100644
@@ -742,7 +742,7 @@ static void __init set_non_bootmem_pages_init(void)
 		if (start == 0)
 			continue;  /* bootmem */
 		end = start + z->spanned_pages;
-		if (zone_idx(z) == ZONE_DMA) {
+		if (zone_idx(z) == ZONE_NORMAL) {
 			BUG_ON(start != node_start_pfn[nid]);
 			start = node_free_pfn[nid];
 		}
Signature · 1 line
1.6.5.2
#91 lore raw

Re: [PATCH] arch/tile: respond to reviews of the second code submission.

In reply to Chris Metcalf
Quoted 1 line · On Thu, 3 Jun 2010 17:32:17 -0400 Chris Metcalf <[email protected]> wrote:

This change addresses DMA-related comments by FUJITA Tomonori

What about the comment on dma_alloc_coherent()?

The rest changes look fine.

#92 lore raw

Re: [PATCH] arch/tile: respond to reviews of the second code submission.

Quoted 6 lines · On Fri, 4 Jun 2010 10:31:17 +0900 FUJITA Tomonori…
Quoted 1 line · On Thu, 3 Jun 2010 17:32:17 -0400 Chris Metcalf <[email protected]> wrote:

This change addresses DMA-related comments by FUJITA Tomonori

What about the comment on dma_alloc_coherent()?

I saw that you addressed two issues (coherent_mask and GFP_KERNEL usage) in linux-next. Both changes look fine to me.

#93 lore raw

PATCH 4/8 arch/tile: core kernel/ code.

In reply to Chris Metcalf

This omits just the tile-desc_32.c file, which is large enough to merit being in a separate commit.

---
 arch/tile/kernel/Makefile          |   16 +
 arch/tile/kernel/asm-offsets.c     |   76 ++
 arch/tile/kernel/backtrace.c       |  634 ++++++++++++
 arch/tile/kernel/compat.c          |  183 ++++
 arch/tile/kernel/compat_signal.c   |  433 ++++++++
 arch/tile/kernel/early_printk.c    |  109 ++
 arch/tile/kernel/entry.S           |  141 +++
 arch/tile/kernel/head_32.S         |  180 ++++
 arch/tile/kernel/hvglue.lds        |   56 +
 arch/tile/kernel/init_task.c       |   59 ++
 arch/tile/kernel/intvec_32.S       | 2006 ++++++++++++++++++++++++++++++++++++
 arch/tile/kernel/irq.c             |  227 ++++
 arch/tile/kernel/machine_kexec.c   |  291 ++++++
 arch/tile/kernel/messaging.c       |  115 ++
 arch/tile/kernel/module.c          |  257 +++++
 arch/tile/kernel/pci-dma.c         |  231 +++++
 arch/tile/kernel/proc.c            |   91 ++
 arch/tile/kernel/process.c         |  647 ++++++++++++
 arch/tile/kernel/ptrace.c          |  203 ++++
 arch/tile/kernel/reboot.c          |   52 +
 arch/tile/kernel/regs_32.S         |  145 +++
 arch/tile/kernel/relocate_kernel.S |  280 +++++
 arch/tile/kernel/setup.c           | 1497 +++++++++++++++++++++++++++
 arch/tile/kernel/signal.c          |  359 +++++++
 arch/tile/kernel/single_step.c     |  656 ++++++++++++
 arch/tile/kernel/smp.c             |  202 ++++
 arch/tile/kernel/smpboot.c         |  293 ++++++
 arch/tile/kernel/stack.c           |  485 +++++++++
 arch/tile/kernel/sys.c             |  122 +++
 arch/tile/kernel/time.c            |  220 ++++
 arch/tile/kernel/tlb.c             |   97 ++
 arch/tile/kernel/traps.c           |  237 +++++
 arch/tile/kernel/vmlinux.lds.S     |   98 ++
 33 files changed, 10698 insertions(+), 0 deletions(-)
 create mode 100644 arch/tile/kernel/Makefile
 create mode 100644 arch/tile/kernel/asm-offsets.c
 create mode 100644 arch/tile/kernel/backtrace.c
 create mode 100644 arch/tile/kernel/compat.c
 create mode 100644 arch/tile/kernel/compat_signal.c
 create mode 100644 arch/tile/kernel/early_printk.c
 create mode 100644 arch/tile/kernel/entry.S
 create mode 100644 arch/tile/kernel/head_32.S
 create mode 100644 arch/tile/kernel/hvglue.lds
 create mode 100644 arch/tile/kernel/init_task.c
 create mode 100644 arch/tile/kernel/intvec_32.S
 create mode 100644 arch/tile/kernel/irq.c
 create mode 100644 arch/tile/kernel/machine_kexec.c
 create mode 100644 arch/tile/kernel/messaging.c
 create mode 100644 arch/tile/kernel/module.c
 create mode 100644 arch/tile/kernel/pci-dma.c
 create mode 100644 arch/tile/kernel/proc.c
 create mode 100644 arch/tile/kernel/process.c
 create mode 100644 arch/tile/kernel/ptrace.c
 create mode 100644 arch/tile/kernel/reboot.c
 create mode 100644 arch/tile/kernel/regs_32.S
 create mode 100644 arch/tile/kernel/relocate_kernel.S
 create mode 100644 arch/tile/kernel/setup.c
 create mode 100644 arch/tile/kernel/signal.c
 create mode 100644 arch/tile/kernel/single_step.c
 create mode 100644 arch/tile/kernel/smp.c
 create mode 100644 arch/tile/kernel/smpboot.c
 create mode 100644 arch/tile/kernel/stack.c
 create mode 100644 arch/tile/kernel/sys.c
 create mode 100644 arch/tile/kernel/time.c
 create mode 100644 arch/tile/kernel/tlb.c
 create mode 100644 arch/tile/kernel/traps.c
 create mode 100644 arch/tile/kernel/vmlinux.lds.S
arch/tile/kernel/Makefile new file +16 -0
new file mode 100644
index 0000000..756e6ec
@@ -0,0 +1,16 @@
+#
+# Makefile for the Linux/TILE kernel.
+#
+
+extra-y := vmlinux.lds head_$(BITS).o
+obj-y := backtrace.o entry.o init_task.o irq.o messaging.o \
+	pci-dma.o proc.o process.o ptrace.o reboot.o \
+	setup.o signal.o single_step.o stack.o sys.o time.o traps.o \
+	intvec_$(BITS).o regs_$(BITS).o tile-desc_$(BITS).o
+
+obj-$(CONFIG_TILEGX)		+= futex_64.o
+obj-$(CONFIG_COMPAT)		+= compat.o compat_signal.o
+obj-$(CONFIG_SMP)		+= smpboot.o smp.o tlb.o
+obj-$(CONFIG_MODULES)		+= module.o
+obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
+obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o
arch/tile/kernel/asm-offsets.c new file +76 -0

76 lines not on this page · raw message

arch/tile/kernel/backtrace.c new file +634 -0

634 lines not on this page · raw message

arch/tile/kernel/compat.c new file +183 -0

183 lines not on this page · raw message

arch/tile/kernel/compat_signal.c new file +433 -0

433 lines not on this page · raw message

arch/tile/kernel/early_printk.c new file +109 -0

109 lines not on this page · raw message

arch/tile/kernel/entry.S new file +141 -0

141 lines not on this page · raw message

arch/tile/kernel/head_32.S new file +180 -0

180 lines not on this page · raw message

arch/tile/kernel/hvglue.lds new file +56 -0

56 lines not on this page · raw message

arch/tile/kernel/init_task.c new file +59 -0

59 lines not on this page · raw message

arch/tile/kernel/intvec_32.S new file +2006 -0

1,113 lines not on this page · raw message

arch/tile/kernel/irq.c new file +227 -0

227 lines not on this page · raw message

arch/tile/kernel/machine_kexec.c new file +291 -0

291 lines not on this page · raw message

arch/tile/kernel/messaging.c new file +115 -0

115 lines not on this page · raw message

arch/tile/kernel/module.c new file +257 -0

257 lines not on this page · raw message

arch/tile/kernel/pci-dma.c new file +231 -0

231 lines not on this page · raw message

arch/tile/kernel/proc.c new file +91 -0

91 lines not on this page · raw message

arch/tile/kernel/process.c new file +647 -0

647 lines not on this page · raw message

arch/tile/kernel/ptrace.c new file +203 -0

203 lines not on this page · raw message

arch/tile/kernel/reboot.c new file +52 -0

52 lines not on this page · raw message

arch/tile/kernel/regs_32.S new file +145 -0

145 lines not on this page · raw message

arch/tile/kernel/relocate_kernel.S new file +280 -0

280 lines not on this page · raw message

arch/tile/kernel/setup.c new file +1497 -0

1,497 lines not on this page · raw message

arch/tile/kernel/signal.c new file +359 -0

359 lines not on this page · raw message

arch/tile/kernel/single_step.c new file +656 -0

656 lines not on this page · raw message

arch/tile/kernel/smp.c new file +202 -0

202 lines not on this page · raw message

arch/tile/kernel/smpboot.c new file +293 -0

293 lines not on this page · raw message

arch/tile/kernel/stack.c new file +485 -0

485 lines not on this page · raw message

arch/tile/kernel/sys.c new file +122 -0

122 lines not on this page · raw message

arch/tile/kernel/time.c new file +220 -0

220 lines not on this page · raw message

arch/tile/kernel/tlb.c new file +97 -0

97 lines not on this page · raw message

arch/tile/kernel/traps.c new file +237 -0

237 lines not on this page · raw message

arch/tile/kernel/vmlinux.lds.S new file +98 -0

98 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.6.5.2

Part of the diff is not shown here. View the raw message.

#94 lore raw

Re: [PATCH 4/8] arch/tile: core kernel/ code.

Quoted 4 lines · On Fri, 28 May 2010 23:10:39 -0400 Chris Metcalf <[email protected]> wrote:

This omits just the tile-desc_32.c file, which is large enough to merit being in a separate commit.

(snip)

Quoted 34 lines
arch/tile/kernel/pci-dma.c new file +28 -0
new file mode 100644
index 0000000..b1ddc80
@@ -0,0 +1,231 @@
+/*
+ * Copyright 2010 Tilera Corporation. All Rights Reserved.
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation, version 2.
+ *
+ *   This program is distributed in the hope that it will be useful, but
+ *   WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ *   NON INFRINGEMENT.  See the GNU General Public License for
+ *   more details.
+ */
+
+#include <linux/mm.h>
+#include <linux/dma-mapping.h>
+#include <linux/vmalloc.h>
+#include <asm/tlbflush.h>
+#include <asm/homecache.h>
+
+/* Generic DMA mapping functions: */
+
+/*
+ * Allocate what Linux calls "coherent" memory, which for us just
+ * means uncached.
+ */
+void *dma_alloc_coherent(struct device *dev,
+			 size_t size,

arch/tile/kernel/pci-dma.c line 38

Quoted 10 lines
arch/tile/kernel/pci-dma.c new file +10 -0
+			 dma_addr_t *dma_handle,
+			 gfp_t gfp)
+{
+	int order;
+	struct page *pg;
+
+	gfp |= GFP_KERNEL | __GFP_ZERO;
+
+	order = get_order(size);
+	/* alloc on node 0 so the paddr fits in a u32 */

What "the paddr fits in a u32" means? If dev->coherent_dma_mask is larger than DMA_BIT_MASK(32), you can return an address above it?

Quoted 81 lines
arch/tile/kernel/pci-dma.c new file +81 -0
+	pg = homecache_alloc_pages_node(0, gfp, order, PAGE_HOME_UNCACHED);
+	if (pg == NULL)
+		return NULL;
+
+	*dma_handle = page_to_pa(pg);
+	return (void *) page_address(pg);
+}
+EXPORT_SYMBOL(dma_alloc_coherent);
+
+/*
+ * Free memory that was allocated with dma_alloc_coherent.
+ */
+void dma_free_coherent(struct device *dev, size_t size,
+		  void *vaddr, dma_addr_t dma_handle)
+{
+	homecache_free_pages((unsigned long)vaddr, get_order(size));
+}
+EXPORT_SYMBOL(dma_free_coherent);
+
+/*
+ * The map routines "map" the specified address range for DMA
+ * accesses.  The memory belongs to the device after this call is
+ * issued, until it is unmapped with dma_unmap_single.
+ *
+ * We don't need to do any mapping, we just flush the address range
+ * out of the cache and return a DMA address.
+ *
+ * The unmap routines do whatever is necessary before the processor
+ * accesses the memory again, and must be called before the driver
+ * touches the memory.  We can get away with a cache invalidate if we
+ * can count on nothing having been touched.
+ */
+
+
+/*
+ * dma_map_single can be passed any memory address, and there appear
+ * to be no alignment constraints.
+ *
+ * There is a chance that the start of the buffer will share a cache
+ * line with some other data that has been touched in the meantime.
+ */
+dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
+	       enum dma_data_direction direction)
+{
+	struct page *page;
+	dma_addr_t dma_addr;
+	int thispage;
+
+	BUG_ON(!valid_dma_direction(direction));
+	WARN_ON(size == 0);
+
+	dma_addr = __pa(ptr);
+
+	/* We might have been handed a buffer that wraps a page boundary */
+	while ((int)size > 0) {
+		/* The amount to flush that's on this page */
+		thispage = PAGE_SIZE - ((unsigned long)ptr & (PAGE_SIZE - 1));
+		thispage = min((int)thispage, (int)size);
+		/* Is this valid for any page we could be handed? */
+		page = pfn_to_page(kaddr_to_pfn(ptr));
+		homecache_flush_cache(page, 0);
+		ptr += thispage;
+		size -= thispage;
+	}
+
+	return dma_addr;
+}
+EXPORT_SYMBOL(dma_map_single);
+
+void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
+		 enum dma_data_direction direction)
+{
+	BUG_ON(!valid_dma_direction(direction));
+}
+EXPORT_SYMBOL(dma_unmap_single);
+
+int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
+	   enum dma_data_direction direction)
+{
+	int i;
+

arch/tile/kernel/pci-dma.c line 129

Quoted 10 lines
arch/tile/kernel/pci-dma.c new file +10 -0
+	BUG_ON(!valid_dma_direction(direction));
+
+	WARN_ON(nents == 0 || sg[0].length == 0);
+
+	for (i = 0; i < nents; i++) {
+		struct page *page;
+		sg[i].dma_address = sg_phys(sg + i);
+		page = pfn_to_page(sg[i].dma_address >> PAGE_SHIFT);
+		homecache_flush_cache(page, 0);
+	}

Can you use for_each_sg()?

Quoted 62 lines
arch/tile/kernel/pci-dma.c new file +62 -0
+	return nents;
+}
+EXPORT_SYMBOL(dma_map_sg);
+
+void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
+	     enum dma_data_direction direction)
+{
+	BUG_ON(!valid_dma_direction(direction));
+}
+EXPORT_SYMBOL(dma_unmap_sg);
+
+dma_addr_t dma_map_page(struct device *dev, struct page *page,
+			unsigned long offset, size_t size,
+			enum dma_data_direction direction)
+{
+	BUG_ON(!valid_dma_direction(direction));
+
+	homecache_flush_cache(page, 0);
+
+	return page_to_pa(page) + offset;
+}
+EXPORT_SYMBOL(dma_map_page);
+
+void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
+	       enum dma_data_direction direction)
+{
+	BUG_ON(!valid_dma_direction(direction));
+}
+EXPORT_SYMBOL(dma_unmap_page);
+
+void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
+			     size_t size, enum dma_data_direction direction)
+{
+	BUG_ON(!valid_dma_direction(direction));
+}
+EXPORT_SYMBOL(dma_sync_single_for_cpu);
+
+void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
+				size_t size, enum dma_data_direction direction)
+{
+	unsigned long start = PFN_DOWN(dma_handle);
+	unsigned long end = PFN_DOWN(dma_handle + size - 1);
+	unsigned long i;
+
+	BUG_ON(!valid_dma_direction(direction));
+	for (i = start; i <= end; ++i)
+		homecache_flush_cache(pfn_to_page(i), 0);
+}
+EXPORT_SYMBOL(dma_sync_single_for_device);
+
+void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
+		    enum dma_data_direction direction)
+{
+	BUG_ON(!valid_dma_direction(direction));
+	WARN_ON(nelems == 0 || sg[0].length == 0);
+}
+EXPORT_SYMBOL(dma_sync_sg_for_cpu);
+
+/*
+ * Flush and invalidate cache for scatterlist.
+ */
+void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,

arch/tile/kernel/pci-dma.c line 202

Quoted 10 lines
arch/tile/kernel/pci-dma.c new file +10 -0
+			    int nelems, enum dma_data_direction direction)
+{
+	int i;
+
+	BUG_ON(!valid_dma_direction(direction));
+	WARN_ON(nelems == 0 || sg[0].length == 0);
+
+	for (i = 0; i < nelems; i++)
+		dma_sync_single_for_device(dev, sg[i].dma_address,
+					   sg[i].dma_length, direction);

ditto.

#95 lore raw

cover revised patch for arch/tile/ support

In reply to Chris Metcalf
Quoted 5 lines · On May 20 I wrote:

At Tilera we have been running Linux 2.6.26 on our architecture for a while and distributing the sources to our customers. We just sync'ed up our sources to 2.6.34 and would like to return it to the community more widely, so I'm hoping to take advantage of the merge window for 2.6.35 to integrate support for our architecture.

Thanks to some much-appreciated volunteer work reviewing that initial patch, I now have a revised set of patches which I would like to offer for submission to the mainline.

The largest chunk of work has been adopting the "generic" syscall ABI in asm-generic. It required some work extending it to a new architecture, particularly to support both 32- and 64-bit chips, and to support a 32-bit compat layer on the 64-bit architecture. Many thanks to Arnd Bergmann for working with me on this.

In addition, I have wised up and removed most of the driver material from this patch. They are not immediately essential for booting up Tilera Linux, and I will plan to feed the drivers back over time after this initial baseline patch has been accepted.

The patches are in eight commits, the first being the changes to the "generic" ABI. The remaining seven patches are the tile architecture code, broken up into somewhat digestible chunks.

Many thanks to the folks who took the time to review parts of the initial diffs:

Arnd Bergmann <[email protected]>
Barry Song <[email protected]>
Sam Ravnborg <[email protected]>
Thomas Gleixner <[email protected]>
Marc Gauthier <[email protected]>
Jamie Lokier <[email protected]>
and Linus for reviewing my one-line lowmem_page_address() patch :-)

(Sorry for the double-posting to linux-arch and Linus; I included the Cc's but dropped the "To" when I ran git format-patch the first time.)

Chris Metcalf (8):
Fix up the "generic" unistd.h ABI to be more useful. arch/tile: infrastructure and configuration-related files. arch/tile: header files for the Tile architecture. arch/tile: core kernel/ code.
arch/tile: the kernel/tile-desc_32.c file. arch/tile: the mm/ directory.
arch/tile: lib/ directory.
arch/tile: hypervisor console driver.

 MAINTAINERS                                 |    6 +
 arch/tile/Kbuild                            |    3 +
 arch/tile/Kconfig                           |  360 +
 arch/tile/Kconfig.debug                     |   43 +
 arch/tile/Makefile                          |   52 +
 arch/tile/configs/tile_defconfig            | 1289 +++
 arch/tile/include/arch/abi.h                |   93 +
 arch/tile/include/arch/chip.h               |   23 +
 arch/tile/include/arch/chip_tile64.h        |  252 +
 arch/tile/include/arch/chip_tilepro.h       |  252 +
 arch/tile/include/arch/interrupts.h         |   19 +
 arch/tile/include/arch/interrupts_32.h      |  304 +
 arch/tile/include/arch/sim_def.h            |  512 +
 arch/tile/include/arch/spr_def.h            |   19 +
 arch/tile/include/arch/spr_def_32.h         |  162 +
 arch/tile/include/asm/Kbuild                |    3 +
 arch/tile/include/asm/asm-offsets.h         |    1 +
 arch/tile/include/asm/atomic.h              |  159 +
 arch/tile/include/asm/atomic_32.h           |  353 +
 arch/tile/include/asm/auxvec.h              |   20 +
 arch/tile/include/asm/backtrace.h           |  193 +
 arch/tile/include/asm/bitops.h              |  126 +
 arch/tile/include/asm/bitops_32.h           |  132 +
 arch/tile/include/asm/bitsperlong.h         |   26 +
 arch/tile/include/asm/bug.h                 |    1 +
 arch/tile/include/asm/bugs.h                |    1 +
 arch/tile/include/asm/byteorder.h           |    1 +
 arch/tile/include/asm/cache.h               |   50 +
 arch/tile/include/asm/cacheflush.h          |  145 +
 arch/tile/include/asm/checksum.h            |   24 +
 arch/tile/include/asm/compat.h              |  308 +
 arch/tile/include/asm/cputime.h             |    1 +
 arch/tile/include/asm/current.h             |   31 +
 arch/tile/include/asm/delay.h               |   34 +
 arch/tile/include/asm/device.h              |    1 +
 arch/tile/include/asm/div64.h               |    1 +
 arch/tile/include/asm/dma-mapping.h         |  106 +
 arch/tile/include/asm/dma.h                 |   25 +
 arch/tile/include/asm/elf.h                 |  169 +
 arch/tile/include/asm/emergency-restart.h   |    1 +
 arch/tile/include/asm/errno.h               |    1 +
 arch/tile/include/asm/fcntl.h               |    1 +
 arch/tile/include/asm/fixmap.h              |  124 +
 arch/tile/include/asm/ftrace.h              |   20 +
 arch/tile/include/asm/futex.h               |  136 +
 arch/tile/include/asm/hardirq.h             |   47 +
 arch/tile/include/asm/highmem.h             |   73 +
 arch/tile/include/asm/homecache.h           |  125 +
 arch/tile/include/asm/hugetlb.h             |  109 +
 arch/tile/include/asm/hv_driver.h           |   60 +
 arch/tile/include/asm/hw_irq.h              |   18 +
 arch/tile/include/asm/ide.h                 |   25 +
 arch/tile/include/asm/io.h                  |  220 +
 arch/tile/include/asm/ioctl.h               |    1 +
 arch/tile/include/asm/ioctls.h              |    1 +
 arch/tile/include/asm/ipc.h                 |    1 +
 arch/tile/include/asm/ipcbuf.h              |    1 +
 arch/tile/include/asm/irq.h                 |   37 +
 arch/tile/include/asm/irq_regs.h            |    1 +
 arch/tile/include/asm/irqflags.h            |  267 +
 arch/tile/include/asm/kdebug.h              |    1 +
 arch/tile/include/asm/kexec.h               |   53 +
 arch/tile/include/asm/kmap_types.h          |   43 +
 arch/tile/include/asm/linkage.h             |   51 +
 arch/tile/include/asm/local.h               |    1 +
 arch/tile/include/asm/memprof.h             |   33 +
 arch/tile/include/asm/mman.h                |   40 +
 arch/tile/include/asm/mmu.h                 |   31 +
 arch/tile/include/asm/mmu_context.h         |  131 +
 arch/tile/include/asm/mmzone.h              |   81 +
 arch/tile/include/asm/module.h              |    1 +
 arch/tile/include/asm/msgbuf.h              |    1 +
 arch/tile/include/asm/mutex.h               |    1 +
 arch/tile/include/asm/opcode-tile.h         |   30 +
 arch/tile/include/asm/opcode-tile_32.h      | 1597 ++++
 arch/tile/include/asm/opcode-tile_64.h      | 1597 ++++
 arch/tile/include/asm/opcode_constants.h    |   26 +
 arch/tile/include/asm/opcode_constants_32.h |  480 +
 arch/tile/include/asm/opcode_constants_64.h |  480 +
 arch/tile/include/asm/page.h                |  334 +
 arch/tile/include/asm/param.h               |    1 +
 arch/tile/include/asm/pci-bridge.h          |  117 +
 arch/tile/include/asm/pci.h                 |  128 +
 arch/tile/include/asm/percpu.h              |   24 +
 arch/tile/include/asm/pgalloc.h             |  119 +
 arch/tile/include/asm/pgtable.h             |  475 +
 arch/tile/include/asm/pgtable_32.h          |  117 +
 arch/tile/include/asm/poll.h                |    1 +
 arch/tile/include/asm/posix_types.h         |    1 +
 arch/tile/include/asm/processor.h           |  339 +
 arch/tile/include/asm/ptrace.h              |  163 +
 arch/tile/include/asm/resource.h            |    1 +
 arch/tile/include/asm/scatterlist.h         |    1 +
 arch/tile/include/asm/sections.h            |   37 +
 arch/tile/include/asm/sembuf.h              |    1 +
 arch/tile/include/asm/setup.h               |   32 +
 arch/tile/include/asm/shmbuf.h              |    1 +
 arch/tile/include/asm/shmparam.h            |    1 +
 arch/tile/include/asm/sigcontext.h          |   27 +
 arch/tile/include/asm/sigframe.h            |   33 +
 arch/tile/include/asm/siginfo.h             |   30 +
 arch/tile/include/asm/signal.h              |   31 +
 arch/tile/include/asm/smp.h                 |  126 +
 arch/tile/include/asm/socket.h              |    1 +
 arch/tile/include/asm/sockios.h             |    1 +
 arch/tile/include/asm/spinlock.h            |   24 +
 arch/tile/include/asm/spinlock_32.h         |  200 +
 arch/tile/include/asm/spinlock_types.h      |   60 +
 arch/tile/include/asm/stack.h               |   68 +
 arch/tile/include/asm/stat.h                |    1 +
 arch/tile/include/asm/statfs.h              |    1 +
 arch/tile/include/asm/string.h              |   32 +
 arch/tile/include/asm/swab.h                |   29 +
 arch/tile/include/asm/syscall.h             |   79 +
 arch/tile/include/asm/syscalls.h            |   60 +
 arch/tile/include/asm/system.h              |  220 +
 arch/tile/include/asm/termbits.h            |    1 +
 arch/tile/include/asm/termios.h             |    1 +
 arch/tile/include/asm/thread_info.h         |  165 +
 arch/tile/include/asm/timex.h               |   47 +
 arch/tile/include/asm/tlb.h                 |   25 +
 arch/tile/include/asm/tlbflush.h            |  128 +
 arch/tile/include/asm/topology.h            |   85 +
 arch/tile/include/asm/traps.h               |   36 +
 arch/tile/include/asm/types.h               |    1 +
 arch/tile/include/asm/uaccess.h             |  578 ++
 arch/tile/include/asm/ucontext.h            |    1 +
 arch/tile/include/asm/unaligned.h           |   24 +
 arch/tile/include/asm/unistd.h              |   47 +
 arch/tile/include/asm/user.h                |   21 +
 arch/tile/include/asm/xor.h                 |    1 +
 arch/tile/include/hv/drv_pcie_rc_intf.h     |   38 +
 arch/tile/include/hv/hypervisor.h           | 2366 +++++
 arch/tile/include/hv/syscall_public.h       |   42 +
 arch/tile/kernel/Makefile                   |   16 +
 arch/tile/kernel/asm-offsets.c              |   76 +
 arch/tile/kernel/backtrace.c                |  634 ++
 arch/tile/kernel/compat.c                   |  183 +
 arch/tile/kernel/compat_signal.c            |  433 +
 arch/tile/kernel/early_printk.c             |  109 +
 arch/tile/kernel/entry.S                    |  141 +
 arch/tile/kernel/head_32.S                  |  180 +
 arch/tile/kernel/hvglue.lds                 |   56 +
 arch/tile/kernel/init_task.c                |   59 +
 arch/tile/kernel/intvec_32.S                | 2006 ++++
 arch/tile/kernel/irq.c                      |  227 +
 arch/tile/kernel/machine_kexec.c            |  291 +
 arch/tile/kernel/messaging.c                |  115 +
 arch/tile/kernel/module.c                   |  257 +
 arch/tile/kernel/pci-dma.c                  |  231 +
 arch/tile/kernel/proc.c                     |   91 +
 arch/tile/kernel/process.c                  |  647 ++
 arch/tile/kernel/ptrace.c                   |  203 +
 arch/tile/kernel/reboot.c                   |   52 +
 arch/tile/kernel/regs_32.S                  |  145 +
 arch/tile/kernel/relocate_kernel.S          |  280 +
 arch/tile/kernel/setup.c                    | 1497 +++
 arch/tile/kernel/signal.c                   |  359 +
 arch/tile/kernel/single_step.c              |  656 ++
 arch/tile/kernel/smp.c                      |  202 +
 arch/tile/kernel/smpboot.c                  |  293 +
 arch/tile/kernel/stack.c                    |  485 +
 arch/tile/kernel/sys.c                      |  122 +
 arch/tile/kernel/tile-desc_32.c             |13826 +++++++++++++++++++++++++++
 arch/tile/kernel/time.c                     |  220 +
 arch/tile/kernel/tlb.c                      |   97 +
 arch/tile/kernel/traps.c                    |  237 +
 arch/tile/kernel/vmlinux.lds.S              |   98 +
 arch/tile/lib/Makefile                      |   16 +
 arch/tile/lib/__invalidate_icache.S         |  106 +
 arch/tile/lib/atomic_32.c                   |  347 +
 arch/tile/lib/atomic_asm_32.S               |  197 +
 arch/tile/lib/checksum.c                    |  102 +
 arch/tile/lib/cpumask.c                     |   51 +
 arch/tile/lib/delay.c                       |   34 +
 arch/tile/lib/exports.c                     |   78 +
 arch/tile/lib/mb_incoherent.S               |   34 +
 arch/tile/lib/memchr_32.c                   |   68 +
 arch/tile/lib/memcpy_32.S                   |  628 ++
 arch/tile/lib/memcpy_tile64.c               |  271 +
 arch/tile/lib/memmove_32.c                  |   63 +
 arch/tile/lib/memset_32.c                   |  274 +
 arch/tile/lib/spinlock_32.c                 |  221 +
 arch/tile/lib/spinlock_common.h             |   64 +
 arch/tile/lib/strchr_32.c                   |   66 +
 arch/tile/lib/strlen_32.c                   |   36 +
 arch/tile/lib/uaccess.c                     |   31 +
 arch/tile/lib/usercopy_32.S                 |  223 +
 arch/tile/mm/Makefile                       |    9 +
 arch/tile/mm/elf.c                          |  164 +
 arch/tile/mm/extable.c                      |   30 +
 arch/tile/mm/fault.c                        |  905 ++
 arch/tile/mm/highmem.c                      |  328 +
 arch/tile/mm/homecache.c                    |  445 +
 arch/tile/mm/hugetlbpage.c                  |  343 +
 arch/tile/mm/init.c                         | 1082 +++
 arch/tile/mm/migrate.h                      |   50 +
 arch/tile/mm/migrate_32.S                   |  211 +
 arch/tile/mm/mmap.c                         |   75 +
 arch/tile/mm/pgtable.c                      |  566 ++
 drivers/char/Makefile                       |    1 +
 drivers/char/hvc_tile.c                     |   67 +
 include/asm-generic/unistd.h                |   26 +-
 include/linux/syscalls.h                    |    4 +
 204 files changed, 49504 insertions(+), 6 deletions(-)
 create mode 100644 arch/tile/Kbuild
 create mode 100644 arch/tile/Kconfig
 create mode 100644 arch/tile/Kconfig.debug
 create mode 100644 arch/tile/Makefile
 create mode 100644 arch/tile/configs/tile_defconfig
 create mode 100644 arch/tile/include/arch/abi.h
 create mode 100644 arch/tile/include/arch/chip.h
 create mode 100644 arch/tile/include/arch/chip_tile64.h
 create mode 100644 arch/tile/include/arch/chip_tilepro.h
 create mode 100644 arch/tile/include/arch/interrupts.h
 create mode 100644 arch/tile/include/arch/interrupts_32.h
 create mode 100644 arch/tile/include/arch/sim_def.h
 create mode 100644 arch/tile/include/arch/spr_def.h
 create mode 100644 arch/tile/include/arch/spr_def_32.h
 create mode 100644 arch/tile/include/asm/Kbuild
 create mode 100644 arch/tile/include/asm/asm-offsets.h
 create mode 100644 arch/tile/include/asm/atomic.h
 create mode 100644 arch/tile/include/asm/atomic_32.h
 create mode 100644 arch/tile/include/asm/auxvec.h
 create mode 100644 arch/tile/include/asm/backtrace.h
 create mode 100644 arch/tile/include/asm/bitops.h
 create mode 100644 arch/tile/include/asm/bitops_32.h
 create mode 100644 arch/tile/include/asm/bitsperlong.h
 create mode 100644 arch/tile/include/asm/bug.h
 create mode 100644 arch/tile/include/asm/bugs.h
 create mode 100644 arch/tile/include/asm/byteorder.h
 create mode 100644 arch/tile/include/asm/cache.h
 create mode 100644 arch/tile/include/asm/cacheflush.h
 create mode 100644 arch/tile/include/asm/checksum.h
 create mode 100644 arch/tile/include/asm/compat.h
 create mode 100644 arch/tile/include/asm/cputime.h
 create mode 100644 arch/tile/include/asm/current.h
 create mode 100644 arch/tile/include/asm/delay.h
 create mode 100644 arch/tile/include/asm/device.h
 create mode 100644 arch/tile/include/asm/div64.h
 create mode 100644 arch/tile/include/asm/dma-mapping.h
 create mode 100644 arch/tile/include/asm/dma.h
 create mode 100644 arch/tile/include/asm/elf.h
 create mode 100644 arch/tile/include/asm/emergency-restart.h
 create mode 100644 arch/tile/include/asm/errno.h
 create mode 100644 arch/tile/include/asm/fcntl.h
 create mode 100644 arch/tile/include/asm/fixmap.h
 create mode 100644 arch/tile/include/asm/ftrace.h
 create mode 100644 arch/tile/include/asm/futex.h
 create mode 100644 arch/tile/include/asm/hardirq.h
 create mode 100644 arch/tile/include/asm/highmem.h
 create mode 100644 arch/tile/include/asm/homecache.h
 create mode 100644 arch/tile/include/asm/hugetlb.h
 create mode 100644 arch/tile/include/asm/hv_driver.h
 create mode 100644 arch/tile/include/asm/hw_irq.h
 create mode 100644 arch/tile/include/asm/ide.h
 create mode 100644 arch/tile/include/asm/io.h
 create mode 100644 arch/tile/include/asm/ioctl.h
 create mode 100644 arch/tile/include/asm/ioctls.h
 create mode 100644 arch/tile/include/asm/ipc.h
 create mode 100644 arch/tile/include/asm/ipcbuf.h
 create mode 100644 arch/tile/include/asm/irq.h
 create mode 100644 arch/tile/include/asm/irq_regs.h
 create mode 100644 arch/tile/include/asm/irqflags.h
 create mode 100644 arch/tile/include/asm/kdebug.h
 create mode 100644 arch/tile/include/asm/kexec.h
 create mode 100644 arch/tile/include/asm/kmap_types.h
 create mode 100644 arch/tile/include/asm/linkage.h
 create mode 100644 arch/tile/include/asm/local.h
 create mode 100644 arch/tile/include/asm/memprof.h
 create mode 100644 arch/tile/include/asm/mman.h
 create mode 100644 arch/tile/include/asm/mmu.h
 create mode 100644 arch/tile/include/asm/mmu_context.h
 create mode 100644 arch/tile/include/asm/mmzone.h
 create mode 100644 arch/tile/include/asm/module.h
 create mode 100644 arch/tile/include/asm/msgbuf.h
 create mode 100644 arch/tile/include/asm/mutex.h
 create mode 100644 arch/tile/include/asm/opcode-tile.h
 create mode 100644 arch/tile/include/asm/opcode-tile_32.h
 create mode 100644 arch/tile/include/asm/opcode-tile_64.h
 create mode 100644 arch/tile/include/asm/opcode_constants.h
 create mode 100644 arch/tile/include/asm/opcode_constants_32.h
 create mode 100644 arch/tile/include/asm/opcode_constants_64.h
 create mode 100644 arch/tile/include/asm/page.h
 create mode 100644 arch/tile/include/asm/param.h
 create mode 100644 arch/tile/include/asm/pci-bridge.h
 create mode 100644 arch/tile/include/asm/pci.h
 create mode 100644 arch/tile/include/asm/percpu.h
 create mode 100644 arch/tile/include/asm/pgalloc.h
 create mode 100644 arch/tile/include/asm/pgtable.h
 create mode 100644 arch/tile/include/asm/pgtable_32.h
 create mode 100644 arch/tile/include/asm/poll.h
 create mode 100644 arch/tile/include/asm/posix_types.h
 create mode 100644 arch/tile/include/asm/processor.h
 create mode 100644 arch/tile/include/asm/ptrace.h
 create mode 100644 arch/tile/include/asm/resource.h
 create mode 100644 arch/tile/include/asm/scatterlist.h
 create mode 100644 arch/tile/include/asm/sections.h
 create mode 100644 arch/tile/include/asm/sembuf.h
 create mode 100644 arch/tile/include/asm/setup.h
 create mode 100644 arch/tile/include/asm/shmbuf.h
 create mode 100644 arch/tile/include/asm/shmparam.h
 create mode 100644 arch/tile/include/asm/sigcontext.h
 create mode 100644 arch/tile/include/asm/sigframe.h
 create mode 100644 arch/tile/include/asm/siginfo.h
 create mode 100644 arch/tile/include/asm/signal.h
 create mode 100644 arch/tile/include/asm/smp.h
 create mode 100644 arch/tile/include/asm/socket.h
 create mode 100644 arch/tile/include/asm/sockios.h
 create mode 100644 arch/tile/include/asm/spinlock.h
 create mode 100644 arch/tile/include/asm/spinlock_32.h
 create mode 100644 arch/tile/include/asm/spinlock_types.h
 create mode 100644 arch/tile/include/asm/stack.h
 create mode 100644 arch/tile/include/asm/stat.h
 create mode 100644 arch/tile/include/asm/statfs.h
 create mode 100644 arch/tile/include/asm/string.h
 create mode 100644 arch/tile/include/asm/swab.h
 create mode 100644 arch/tile/include/asm/syscall.h
 create mode 100644 arch/tile/include/asm/syscalls.h
 create mode 100644 arch/tile/include/asm/system.h
 create mode 100644 arch/tile/include/asm/termbits.h
 create mode 100644 arch/tile/include/asm/termios.h
 create mode 100644 arch/tile/include/asm/thread_info.h
 create mode 100644 arch/tile/include/asm/timex.h
 create mode 100644 arch/tile/include/asm/tlb.h
 create mode 100644 arch/tile/include/asm/tlbflush.h
 create mode 100644 arch/tile/include/asm/topology.h
 create mode 100644 arch/tile/include/asm/traps.h
 create mode 100644 arch/tile/include/asm/types.h
 create mode 100644 arch/tile/include/asm/uaccess.h
 create mode 100644 arch/tile/include/asm/ucontext.h
 create mode 100644 arch/tile/include/asm/unaligned.h
 create mode 100644 arch/tile/include/asm/unistd.h
 create mode 100644 arch/tile/include/asm/user.h
 create mode 100644 arch/tile/include/asm/xor.h
 create mode 100644 arch/tile/include/hv/drv_pcie_rc_intf.h
 create mode 100644 arch/tile/include/hv/hypervisor.h
 create mode 100644 arch/tile/include/hv/syscall_public.h
 create mode 100644 arch/tile/kernel/Makefile
 create mode 100644 arch/tile/kernel/asm-offsets.c
 create mode 100644 arch/tile/kernel/backtrace.c
 create mode 100644 arch/tile/kernel/compat.c
 create mode 100644 arch/tile/kernel/compat_signal.c
 create mode 100644 arch/tile/kernel/early_printk.c
 create mode 100644 arch/tile/kernel/entry.S
 create mode 100644 arch/tile/kernel/head_32.S
 create mode 100644 arch/tile/kernel/hvglue.lds
 create mode 100644 arch/tile/kernel/init_task.c
 create mode 100644 arch/tile/kernel/intvec_32.S
 create mode 100644 arch/tile/kernel/irq.c
 create mode 100644 arch/tile/kernel/machine_kexec.c
 create mode 100644 arch/tile/kernel/messaging.c
 create mode 100644 arch/tile/kernel/module.c
 create mode 100644 arch/tile/kernel/pci-dma.c
 create mode 100644 arch/tile/kernel/proc.c
 create mode 100644 arch/tile/kernel/process.c
 create mode 100644 arch/tile/kernel/ptrace.c
 create mode 100644 arch/tile/kernel/reboot.c
 create mode 100644 arch/tile/kernel/regs_32.S
 create mode 100644 arch/tile/kernel/relocate_kernel.S
 create mode 100644 arch/tile/kernel/setup.c
 create mode 100644 arch/tile/kernel/signal.c
 create mode 100644 arch/tile/kernel/single_step.c
 create mode 100644 arch/tile/kernel/smp.c
 create mode 100644 arch/tile/kernel/smpboot.c
 create mode 100644 arch/tile/kernel/stack.c
 create mode 100644 arch/tile/kernel/sys.c
 create mode 100644 arch/tile/kernel/tile-desc_32.c
 create mode 100644 arch/tile/kernel/time.c
 create mode 100644 arch/tile/kernel/tlb.c
 create mode 100644 arch/tile/kernel/traps.c
 create mode 100644 arch/tile/kernel/vmlinux.lds.S
 create mode 100644 arch/tile/lib/Makefile
 create mode 100644 arch/tile/lib/__invalidate_icache.S
 create mode 100644 arch/tile/lib/atomic_32.c
 create mode 100644 arch/tile/lib/atomic_asm_32.S
 create mode 100644 arch/tile/lib/checksum.c
 create mode 100644 arch/tile/lib/cpumask.c
 create mode 100644 arch/tile/lib/delay.c
 create mode 100644 arch/tile/lib/exports.c
 create mode 100644 arch/tile/lib/mb_incoherent.S
 create mode 100644 arch/tile/lib/memchr_32.c
 create mode 100644 arch/tile/lib/memcpy_32.S
 create mode 100644 arch/tile/lib/memcpy_tile64.c
 create mode 100644 arch/tile/lib/memmove_32.c
 create mode 100644 arch/tile/lib/memset_32.c
 create mode 100644 arch/tile/lib/spinlock_32.c
 create mode 100644 arch/tile/lib/spinlock_common.h
 create mode 100644 arch/tile/lib/strchr_32.c
 create mode 100644 arch/tile/lib/strlen_32.c
 create mode 100644 arch/tile/lib/uaccess.c
 create mode 100644 arch/tile/lib/usercopy_32.S
 create mode 100644 arch/tile/mm/Makefile
 create mode 100644 arch/tile/mm/elf.c
 create mode 100644 arch/tile/mm/extable.c
 create mode 100644 arch/tile/mm/fault.c
 create mode 100644 arch/tile/mm/highmem.c
 create mode 100644 arch/tile/mm/homecache.c
 create mode 100644 arch/tile/mm/hugetlbpage.c
 create mode 100644 arch/tile/mm/init.c
 create mode 100644 arch/tile/mm/migrate.h
 create mode 100644 arch/tile/mm/migrate_32.S
 create mode 100644 arch/tile/mm/mmap.c
 create mode 100644 arch/tile/mm/pgtable.c
 create mode 100644 drivers/char/hvc_tile.c
maintainer Acked-by on the v1 series
#96 lore raw

Re: [PATCH 0/8] revised patch for arch/tile/ support

Quoted 10 lines · Chris Metcalf
Quoted 5 lines · On May 20 I wrote:

At Tilera we have been running Linux 2.6.26 on our architecture for a while and distributing the sources to our customers. We just sync'ed up our sources to 2.6.34 and would like to return it to the community more widely, so I'm hoping to take advantage of the merge window for 2.6.35 to integrate support for our architecture.

Thanks to some much-appreciated volunteer work reviewing that initial patch, I now have a revised set of patches which I would like to offer for submission to the mainline.

It seems that you have addressed all my review comments and all the other comments that I have seen in the best possible ways. All the controversial parts from the original code are either corrected or (in case of nonessential drivers) deferred to a future review. I did not expect this to be possibly in such a short time, and it continues to amaze me.

Consequently, I fully support this series to go into 2.6.35. To the entire series:

maintainer
#97 lore raw

Re: [PATCH 0/8] revised patch for arch/tile/ support

Quoted 13 lines · On Saturday 29 May 2010 13:29:10 Arnd Bergmann wrote:
Quoted 4 lines · Chris Metcalf

Thanks to some much-appreciated volunteer work reviewing that initial patch, I now have a revised set of patches which I would like to offer for submission to the mainline.

It seems that you have addressed all my review comments and all the other comments that I have seen in the best possible ways. All the controversial parts from the original code are either corrected or (in case of nonessential drivers) deferred to a future review. I did not expect this to be possibly in such a short time, and it continues to amaze me.

Quoted 4 lines

Consequently, I fully support this series to go into 2.6.35. To the entire series:

Hi Chris,

You evidently didn't make it into -rc1, probably because Linus considered your submission to be too late, or possibly because some of the bigger patches got lost in an email filter.

To go forward with your architecture, I suggest that you start adding it to the linux-next tree. Until you have a git tree, the easiest way to do that is to put a tarball in quilt format at a http url under your control, and ask Stephen to include that.

Feel free to add a 'Reviewed-by: Arnd Bergmann <[email protected]>' to your existing patches, and do your further work as patches on top of that.

Arnd

#98 lore raw

Re: [PATCH 0/8] revised patch for arch/tile/ support

Quoted 4 lines · Arnd Bergmann

You evidently didn't make it into -rc1, probably because Linus considered your submission to be too late, or possibly because some of the bigger patches got lost in an email filter.

Quoted 8 lines

To go forward with your architecture, I suggest that you start adding it to the linux-next tree. Until you have a git tree, the easiest way to do that is to put a tarball in quilt format at a http url under your control, and ask Stephen to include that.

Feel free to add a 'Reviewed-by: Arnd Bergmann <[email protected]>' to your existing patches, and do your further work as patches on top of that.

I will plan to push the commits I have mailed to LKML up to a tree on kernel.org, since I now have an account there, probably tomorrow. I'll send an email to Stephen with a pointer and see where it goes from there.

And Arnd, many thanks -- it's confusing to navigate the jungle of how code actually makes it into the kernel, and a little help goes a long way!

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#99 lore raw

Re: [PATCH 0/8] revised patch for arch/tile/ support

In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

You evidently didn't make it into -rc1, probably because Linus considered your submission to be too late, or possibly because some of the bigger patches got lost in an email filter.

To go forward with your architecture, I suggest that you start adding it to the linux-next tree. Until you have a git tree, the easiest way to do that is to put a tarball in quilt format at a http url under your control, and ask Stephen to include that.

I've set up a GIT tree for the Tilera architecture support here:

git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile.git

I kept the commit to fix up the "generic" unistd.h ABI and added Arnd's Acked-by to the commit message, and I combined the v2 Tilera-specific series of patches along with responses to the v2 patches into a single commit, with appropriate Acked-by and Reviewed-by based on what folks had said.

Stephen, in an ideal world you could add this repository to your set of things you pull from into linux-next, and going forward I would then be the gatekeeper for "arch/tile/" changes. I'll plan to continue mailing the diffs to LKML for public review, and push them up to git.kernel.org after feedback has died down and they are ready to go to linux-next. Does that sound good to you?

Many thanks!

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#100 lore raw

Re: [PATCH 0/8] revised patch for arch/tile/ support

Hi Chris,

Quoted 21 lines · On Fri, 04 Jun 2010 17:32:52 -0400 Chris Metcalf <[email protected]> wrote:
Quoted 8 lines · Arnd Bergmann

You evidently didn't make it into -rc1, probably because Linus considered your submission to be too late, or possibly because some of the bigger patches got lost in an email filter.

To go forward with your architecture, I suggest that you start adding it to the linux-next tree. Until you have a git tree, the easiest way to do that is to put a tarball in quilt format at a http url under your control, and ask Stephen to include that.

I've set up a GIT tree for the Tilera architecture support here:

git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile.git

I kept the commit to fix up the "generic" unistd.h ABI and added Arnd's Acked-by to the commit message, and I combined the v2 Tilera-specific series of patches along with responses to the v2 patches into a single commit, with appropriate Acked-by and Reviewed-by based on what folks had said.

Quoted 6 lines

Stephen, in an ideal world you could add this repository to your set of things you pull from into linux-next, and going forward I would then be the gatekeeper for "arch/tile/" changes. I'll plan to continue mailing the diffs to LKML for public review, and push them up to git.kernel.org after feedback has died down and they are ready to go to linux-next. Does that sound good to you?

That sounds pretty good. I have added the master branch from that tree and it will appear in linux-next from Monday.

Thanks for adding your subsystem tree as a participant of linux-next. As you may know, this is not a judgment of your code. The purpose of linux-next is for integration testing and to lower the impact of conflicts between subsystems in the next merge window.

You will need to ensure that the patches/commits in your tree/series have been:
* submitted under GPL v2 (or later) and include the Contributor's Signed-off-by,
* posted to the relevant mailing list,
* reviewed by you (or another maintainer of your subsystem tree),
* successfully unit tested, and
* destined for the current or next Linux merge window.

Basically, this should be just what you would send to Linus (or ask him to fetch). It is allowed to be rebased if you deem it necessary.

Signature · 15 lines
Cheers,
Stephen Rothwell 
[email protected]

Legal Stuff:
By participating in linux-next, your subsystem tree contributions are
public and will be included in the linux-next trees.  You may be sent
e-mail messages indicating errors or other issues when the
patches/commits from your subsystem tree are merged and tested in
linux-next.  These messages may also be cross-posted to the linux-next
mailing list, the linux-kernel mailing list, etc.  The linux-next tree
project and IBM (my employer) make no warranties regarding the linux-next
project, the testing procedures, the results, the e-mails, etc.  If you
don't agree to these ground rules, let me know and I'll remove your tree
from participation in linux-next.
#101 lore raw

Re: [PATCH 0/8] revised patch for arch/tile/ support

Quoted 10 lines · Stephen Rothwell
Quoted 5 lines · On Fri, 04 Jun 2010 17:32:52 -0400 Chris Metcalf <[email protected]> wrote:

I've set up a GIT tree for the Tilera architecture support here:
git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile.git

[...]

That sounds pretty good. I have added the master branch from that tree and it will appear in linux-next from Monday.

Thanks, Stephen. One question: has linux-next reached the point where Linus pulls from it automatically during each merge window, or should I still ask Linus explicitly to pull for the 2.6.36 merge window?

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#102 lore raw

Re: [PATCH 0/8] revised patch for arch/tile/ support

Hi Chris,

Quoted 4 lines · On Sat, 05 Jun 2010 09:30:40 -0400 Chris Metcalf <[email protected]> wrote:

Thanks, Stephen. One question: has linux-next reached the point where Linus pulls from it automatically during each merge window, or should I still ask Linus explicitly to pull for the 2.6.36 merge window?

You need to ask Linus to pull your tree when you are ready.

P.S. I noticed that you just added a commit with no Signed-off-by ...

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#104 lore raw

Re: [PATCH 0/8] revised patch for arch/tile/ support

Arnd Bergmann suggested that providing a diff of what has changed between the two "arch/tile" patch sets would be helpful to the reviewers.

The "hvglue.ld" file was renamed, but I didn't bother to include it in the diff otherwise, since all that changed was the addition of a comment at the top. A new "spinlock_common.h" is included in the diff.

Kbuild +0 -1
diff -ru tile.old/Kbuild tile/Kbuild
@@ -1,4 +1,3 @@
 
 obj-y += kernel/
 obj-y += mm/
-obj-y += feedback/
Kconfig +106 -279

463 lines not on this page · raw message

Kconfig.debug +0 -6
diff -ru tile.old/Kconfig.debug tile/Kconfig.debug
@@ -1,13 +1,7 @@
 menu "Kernel hacking"
 
-config TRACE_IRQFLAGS_SUPPORT
-	def_bool y
-
 source "lib/Kconfig.debug"
 
-config STRICT_DEVMEM
-	def_bool y
-
 config EARLY_PRINTK
 	bool "Early printk" if EMBEDDED && DEBUG_KERNEL
 	default y
Makefile +15 -31

70 lines not on this page · raw message

configs/tile_defconfig +36 -44

172 lines not on this page · raw message

Only in tile.old: drivers
Only in tile.old: feedback

include/arch/abi.h +1 -1
diff -ru tile.old/include/arch/abi.h tile/include/arch/abi.h
@@ -76,7 +76,7 @@
 //! String prefix to use for printf().
 #define INT_REG_FMT "ll"
 
-#else
+#elif !defined(__LP64__)   /* avoid confusion with LP64 cross-build tools */
 
 //! Unsigned type that can hold a register.
 typedef unsigned long uint_reg_t;
include/arch/chip.h +2 -2
diff -ru tile.old/include/arch/chip.h tile/include/arch/chip.h
@@ -16,8 +16,8 @@
 #include <arch/chip_tile64.h>
 #elif __tile_chip__ == 1
 #include <arch/chip_tilepro.h>
-
-
+#elif defined(__tilegx__)
+#include <arch/chip_tilegx.h>
 #else
 #error Unexpected Tilera chip type
 #endif
include/arch/chip_tile64.h +38 -38

98 lines not on this page · raw message

include/arch/chip_tilepro.h +38 -38

98 lines not on this page · raw message

Only in tile.old/include/arch: cycle.h
Only in tile.old/include/arch: inline.h

include/arch/interrupts.h +4 -3
diff -ru tile.old/include/arch/interrupts.h tile/include/arch/interrupts.h
@@ -12,7 +12,8 @@
  *   more details.
  */
 
-
-
-
+#ifdef __tilegx__
+#include <arch/interrupts_64.h>
+#else
 #include <arch/interrupts_32.h>
+#endif

Only in tile.old/include/arch: sim.h

include/arch/spr_def.h +4 -3
diff -ru tile.old/include/arch/spr_def.h tile/include/arch/spr_def.h
@@ -12,7 +12,8 @@
  *   more details.
  */
 
-
-
-
+#ifdef __tilegx__
+#include <arch/spr_def_64.h>
+#else
 #include <arch/spr_def_32.h>
+#endif
include/asm/Kbuild +0 -14
diff -ru tile.old/include/asm/Kbuild tile/include/asm/Kbuild
@@ -1,17 +1,3 @@
 include include/asm-generic/Kbuild.asm
 
-header-y += hardwall.h
-header-y += memprof.h
 header-y += ucontext.h
-header-y += user.h
-
-unifdef-y += bme.h
-unifdef-y += page.h
-unifdef-y += tilepci.h
-
-# FIXME: The kernel probably shouldn't provide these to user-space,
-# but it's convenient for now to do so.
-unifdef-y += opcode-tile.h
-unifdef-y += opcode_constants.h
-unifdef-y += opcode-tile_32.h
-unifdef-y += opcode_constants_32.h

Only in tile.old/include/asm: a.out.h
Only in tile.old/include/asm: addrspace.h
Only in tile.old/include/asm: asm.h

include/asm/atomic.h +4 -4
diff -ru tile.old/include/asm/atomic.h tile/include/asm/atomic.h
@@ -145,11 +145,11 @@
 
 #endif /* __ASSEMBLY__ */
 
-
+#ifndef __tilegx__
 #include <asm/atomic_32.h>
-
-
-
+#else
+#include <asm/atomic_64.h>
+#endif
 
 /* Provide the appropriate atomic_long_t definitions. */
 #ifndef __ASSEMBLY__
include/asm/backtrace.h +0 -25
diff -ru tile.old/include/asm/backtrace.h tile/include/asm/backtrace.h
@@ -15,18 +15,9 @@
 #ifndef _TILE_BACKTRACE_H
 #define _TILE_BACKTRACE_H
 
-#ifndef _LANGUAGE_ASSEMBLY
 
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
 
-#ifdef __KERNEL__
 #include <linux/types.h>
-#else
-#include <stdint.h>
-#include <stdbool.h>
-#endif
 
 #include <arch/chip.h>
 
@@ -197,22 +188,6 @@
 } CallerLocation;
 
 
-#ifdef __cplusplus
-}  /* extern "C" */
-#endif /* __cplusplus */
-
-#else  /* __ASSEMBLY__ */
-
-/* BacktraceIterator offsets */
-#define BACKTRACE_ITERATOR_SIZE                     24
-
-#define BACKTRACE_ITERATOR_PC_OFFSET                 0
-#define BACKTRACE_ITERATOR_SP_OFFSET                 4
-#define BACKTRACE_ITERATOR_FP_OFFSET                 8
-#define BACKTRACE_ITERATOR_INITIAL_FRAME_CALLER_PC  12
-#define BACKTRACE_ITERATOR_READ_MEMORY_FUNC         16
-#define BACKTRACE_ITERATOR_READ_MEMORY_FUNC_EXTRA   20
 
-#endif /* __ASSEMBLY__ */
 
 #endif /* _TILE_BACKTRACE_H */
include/asm/bitops.h +4 -4
diff -ru tile.old/include/asm/bitops.h tile/include/asm/bitops.h
@@ -22,11 +22,11 @@
 #error only <linux/bitops.h> can be included directly
 #endif
 
-
-
-
+#ifdef __tilegx__
+#include <asm/bitops_64.h>
+#else
 #include <asm/bitops_32.h>
-
+#endif
 
 /**
  * __ffs - find first set bit in word
include/asm/bitsperlong.h +4 -4
diff -ru tile.old/include/asm/bitsperlong.h tile/include/asm/bitsperlong.h
@@ -15,11 +15,11 @@
 #ifndef _ASM_TILE_BITSPERLONG_H
 #define _ASM_TILE_BITSPERLONG_H
 
-
-
-
+#ifdef __LP64__
+# define __BITS_PER_LONG 64
+#else
 # define __BITS_PER_LONG 32
-
+#endif
 
 #include <asm-generic/bitsperlong.h>
 

Only in tile.old/include/asm: bme.h

include/asm/bugs.h +1 -22
diff -ru tile.old/include/asm/bugs.h tile/include/asm/bugs.h
@@ -1,22 +1 @@
-/*
- * Copyright 2010 Tilera Corporation. All Rights Reserved.
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation, version 2.
- *
- *   This program is distributed in the hope that it will be useful, but
- *   WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- *   NON INFRINGEMENT.  See the GNU General Public License for
- *   more details.
- */
-
-#ifndef _ASM_TILE_BUGS_H
-#define _ASM_TILE_BUGS_H
-
-static inline void check_bugs(void)
-{
-}
-
-#endif /* _ASM_TILE_BUGS_H */
+#include <asm-generic/bugs.h>
include/asm/byteorder.h +0 -19
diff -ru tile.old/include/asm/byteorder.h tile/include/asm/byteorder.h
@@ -1,20 +1 @@
-/*
- * Copyright 2010 Tilera Corporation. All Rights Reserved.
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation, version 2.
- *
- *   This program is distributed in the hope that it will be useful, but
- *   WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- *   NON INFRINGEMENT.  See the GNU General Public License for
- *   more details.
- */
-
-#ifndef _ASM_TILE_BYTEORDER_H
-#define _ASM_TILE_BYTEORDER_H
-
 #include <linux/byteorder/little_endian.h>
-
-#endif /* _ASM_TILE_BYTEORDER_H */
include/asm/checksum.h +4 -100

110 lines not on this page · raw message

include/asm/compat.h +61 -5

79 lines not on this page · raw message

include/asm/delay.h +0 -24
diff -ru tile.old/include/asm/delay.h tile/include/asm/delay.h
@@ -15,8 +15,6 @@
 #ifndef _ASM_TILE_DELAY_H
 #define _ASM_TILE_DELAY_H
 
-#include <arch/cycle.h>
-
 /* Undefined functions to get compile-time errors. */
 extern void __bad_udelay(void);
 extern void __bad_ndelay(void);
@@ -33,26 +31,4 @@
 	((n) > 20000 ? __bad_ndelay() : __ndelay(n)) : \
 	__ndelay(n))
 
-/*
- * Our stall mechanism is an instruction that takes 6 cycles, and
- * looping around it takes 8.
- */
-#define CYCLES_PER_RELAX_LOOP 8
-
-/*
- * Idle the core for 8 * iterations cycles.
- * Also make this a compiler barrier, as it's sometimes used in
- * lieue of cpu_relax(), which has barrier semantics.
- */
-static inline void
-relax(int iterations)
-{
-	for (/*above*/; iterations > 0; iterations--)
-		cycle_relax();
-	barrier();
-}
-
-/* Delay using bounded exponential backoff. */
-extern void delay_backoff(int iterations);
-
 #endif /* _ASM_TILE_DELAY_H */
include/asm/dma-mapping.h +11 -35

57 lines not on this page · raw message

include/asm/dma.h +2 -11
diff -ru tile.old/include/asm/dma.h tile/include/asm/dma.h
@@ -15,20 +15,11 @@
 #ifndef _ASM_TILE_DMA_H
 #define _ASM_TILE_DMA_H
 
-#include <asm/page.h>
-
-#define MAX_DMA_ADDRESS	((unsigned long)high_memory - 1)
-
-/* Reserve a DMA channel. */
-extern int request_dma(unsigned int dmanr, const char *device_id);
-
-/* Release it again. */
-extern void free_dma(unsigned int dmanr);
+#include <asm-generic/dma.h>
 
+/* Needed by drivers/pci/quirks.c */
 #ifdef CONFIG_PCI
 extern int isa_dma_bridge_buggy;
-#else
-#define isa_dma_bridge_buggy    (0)
 #endif
 
 #endif /* _ASM_TILE_DMA_H */
include/asm/elf.h +15 -19
diff -ru tile.old/include/asm/elf.h tile/include/asm/elf.h
@@ -39,11 +39,11 @@
 typedef double elf_fpreg_t;
 typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
 
-
-
-
+#ifdef __tilegx__
+#define ELF_CLASS	ELFCLASS64
+#else
 #define ELF_CLASS	ELFCLASS32
-
+#endif
 #define ELF_DATA	ELFDATA2LSB
 
 /*
@@ -63,23 +63,23 @@
 	  (x)->e_machine == CHIP_COMPAT_ELF_TYPE()))
 
 /* The module loader only handles a few relocation types. */
-
+#ifndef __tilegx__
 #define R_TILE_32                 1
 #define R_TILE_JOFFLONG_X1       15
 #define R_TILE_IMM16_X0_LO       25
 #define R_TILE_IMM16_X1_LO       26
 #define R_TILE_IMM16_X0_HA       29
 #define R_TILE_IMM16_X1_HA       30
-
-
-
-
-
-
-
-
-
-
+#else
+#define R_TILEGX_64                       1
+#define R_TILEGX_JUMPOFF_X1              21
+#define R_TILEGX_IMM16_X0_HW0            36
+#define R_TILEGX_IMM16_X1_HW0            37
+#define R_TILEGX_IMM16_X0_HW1            38
+#define R_TILEGX_IMM16_X1_HW1            39
+#define R_TILEGX_IMM16_X0_HW2_LAST       48
+#define R_TILEGX_IMM16_X1_HW2_LAST       49
+#endif
 
 /* Use standard page size for core dumps. */
 #define ELF_EXEC_PAGESIZE	PAGE_SIZE
@@ -120,8 +120,6 @@
 extern int dump_task_regs(struct task_struct *, elf_gregset_t *);
 #define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
 
-#ifdef __KERNEL__
-
 /* Tilera Linux has no personalities currently, so no need to do anything. */
 #define SET_PERSONALITY(ex) do { } while (0)
 
@@ -130,8 +128,6 @@
 struct linux_binprm;
 extern int arch_setup_additional_pages(struct linux_binprm *bprm,
 				       int executable_stack);
-#endif
-
 #ifdef CONFIG_COMPAT
 
 #define COMPAT_ELF_PLATFORM "tilegx-m32"
include/asm/futex.h +16 -19
diff -ru tile.old/include/asm/futex.h tile/include/asm/futex.h
@@ -23,7 +23,6 @@
 #ifndef _ASM_TILE_FUTEX_H
 #define _ASM_TILE_FUTEX_H
 
-#ifdef __KERNEL__
 #ifndef __ASSEMBLY__
 
 #include <linux/futex.h>
@@ -36,23 +35,23 @@
 extern struct __get_user futex_andn(int *v, int n);
 extern struct __get_user futex_cmpxchg(int *v, int o, int n);
 
-
+#ifndef __tilegx__
 extern struct __get_user futex_xor(int *v, int n);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+#else
+static inline struct __get_user futex_xor(int __user *uaddr, int n)
+{
+	struct __get_user asm_ret = __get_user_4(uaddr);
+	if (!asm_ret.err) {
+		int oldval, newval;
+		do {
+			oldval = asm_ret.val;
+			newval = oldval ^ n;
+			asm_ret = futex_cmpxchg(uaddr, oldval, newval);
+		} while (asm_ret.err == 0 && oldval != asm_ret.val);
+	}
+	return asm_ret;
+}
+#endif
 
 static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
 {
@@ -134,6 +133,4 @@
 
 #endif /* !__ASSEMBLY__ */
 
-#endif /* __KERNEL__ */
-
 #endif /* _ASM_TILE_FUTEX_H */

Only in tile.old/include/asm: hardwall.h

include/asm/highmem.h +0 -4
diff -ru tile.old/include/asm/highmem.h tile/include/asm/highmem.h
@@ -21,8 +21,6 @@
 #ifndef _ASM_TILE_HIGHMEM_H
 #define _ASM_TILE_HIGHMEM_H
 
-#ifdef __KERNEL__
-
 #include <linux/interrupt.h>
 #include <linux/threads.h>
 #include <asm/kmap_types.h>
@@ -72,6 +70,4 @@
 
 #define flush_cache_kmaps()	do { } while (0)
 
-#endif /* __KERNEL__ */
-
 #endif /* _ASM_TILE_HIGHMEM_H */
include/asm/homecache.h +0 -121

137 lines not on this page · raw message

Only in tile.old/include/asm: hugevmap.h

include/asm/hv_driver.h +0 -3
diff -ru tile.old/include/asm/hv_driver.h tile/include/asm/hv_driver.h
@@ -20,7 +20,6 @@
 #ifndef _ASM_TILE_HV_DRIVER_H
 #define _ASM_TILE_HV_DRIVER_H
 
-#ifdef __KERNEL__
 #include <hv/hypervisor.h>
 
 struct hv_driver_cb;
@@ -58,6 +57,4 @@
 }
 
 
-#endif /* __KERNEL__ */
-
 #endif /* _ASM_TILE_HV_DRIVER_H */
include/asm/ide.h +0 -4
diff -ru tile.old/include/asm/ide.h tile/include/asm/ide.h
@@ -15,8 +15,6 @@
 #ifndef _ASM_TILE_IDE_H
 #define _ASM_TILE_IDE_H
 
-#ifdef __KERNEL__
-
 /* For IDE on PCI */
 #define MAX_HWIFS       10
 
@@ -24,6 +22,4 @@
 
 #include <asm-generic/ide_iops.h>
 
-#endif /* __KERNEL__ */
-
 #endif /* _ASM_TILE_IDE_H */
include/asm/io.h +129 -135

311 lines not on this page · raw message

include/asm/irq.h +5 -12
diff -ru tile.old/include/asm/irq.h tile/include/asm/irq.h
@@ -15,7 +15,6 @@
 #ifndef _ASM_TILE_IRQ_H
 #define _ASM_TILE_IRQ_H
 
-#ifdef __KERNEL__
 #include <linux/hardirq.h>
 
 /* The hypervisor interface provides 32 IRQs. */
@@ -27,18 +26,12 @@
 /* The HV interrupt state object. */
 DECLARE_PER_CPU(HV_IntrState, dev_intr_state);
 
-
 void ack_bad_irq(unsigned int irq);
-void tile_irq_request_level(int tile_irq);
-void tile_irq_request_edge(int tile_irq);
-void tile_enable_irq(int irq);
-
-/* Register or unregister a function to be called upon a particular IRQ. */
-void tile_request_irq(void (*handler)(void *), void *dev_id, int index);
-void tile_free_irq(int index);
-
-extern int tile_irq_base;
 
-#endif /* __KERNEL__ */
+/*
+ * Paravirtualized drivers should call this when their init calls
+ * discover a valid HV IRQ.
+ */
+void tile_irq_activate(unsigned int irq);
 
 #endif /* _ASM_TILE_IRQ_H */
include/asm/irqflags.h +31 -16

66 lines not on this page · raw message

Only in tile.old/include/asm: kvm.h

include/asm/mman.h +0 -86

97 lines not on this page · raw message

include/asm/mmu_context.h +0 -3
diff -ru tile.old/include/asm/mmu_context.h tile/include/asm/mmu_context.h
@@ -114,9 +114,6 @@
 		 * the icache in case some physical page now being mapped
 		 * has subsequently been repurposed and has new code.
 		 */
-
-
-
 		__flush_icache();
 
 	}

Only in tile/include/asm: opcode-tile_64.h
Only in tile/include/asm: opcode_constants_64.h

include/asm/page.h +45 -57

146 lines not on this page · raw message

include/asm/pci-bridge.h +0 -4
diff -ru tile.old/include/asm/pci-bridge.h tile/include/asm/pci-bridge.h
@@ -15,8 +15,6 @@
 #ifndef _ASM_TILE_PCI_BRIDGE_H
 #define _ASM_TILE_PCI_BRIDGE_H
 
-#ifdef __KERNEL__
-
 #include <linux/ioport.h>
 #include <linux/pci.h>
 
@@ -116,6 +114,4 @@
 }
 #endif
 
-#endif /* __KERNEL__ */
-
 #endif /* _ASM_TILE_PCI_BRIDGE_H */
include/asm/pgalloc.h +19 -15
diff -ru tile.old/include/asm/pgalloc.h tile/include/asm/pgalloc.h
@@ -40,11 +40,11 @@
 
 static inline void set_pmd(pmd_t *pmdp, pmd_t pmd)
 {
-
-
-
+#ifdef CONFIG_64BIT
+	set_pte_order(pmdp, pmd, L2_USER_PGTABLE_ORDER);
+#else
 	set_pte_order(&pmdp->pud.pgd, pmd.pud.pgd, L2_USER_PGTABLE_ORDER);
-
+#endif
 }
 
 static inline void pmd_populate_kernel(struct mm_struct *mm,
@@ -100,16 +100,20 @@
 /* During init, we can shatter kernel huge pages if needed. */
 void shatter_pmd(pmd_t *pmd);
 
-
-
-
-
-
-
-
-
-
-
-
+#ifdef __tilegx__
+/* We share a single page allocator for both L1 and L2 page tables. */
+#if HV_L1_SIZE != HV_L2_SIZE
+# error Rework assumption that L1 and L2 page tables are same size.
+#endif
+#define L1_USER_PGTABLE_ORDER L2_USER_PGTABLE_ORDER
+#define pud_populate(mm, pud, pmd) \
+  pmd_populate_kernel((mm), (pmd_t *)(pud), (pte_t *)(pmd))
+#define pmd_alloc_one(mm, addr) \
+  ((pmd_t *)page_to_virt(pte_alloc_one((mm), (addr))))
+#define pmd_free(mm, pmdp) \
+  pte_free((mm), virt_to_page(pmdp))
+#define __pmd_free_tlb(tlb, pmdp, address) \
+  __pte_free_tlb((tlb), virt_to_page(pmdp), (address))
+#endif
 
 #endif /* _ASM_TILE_PGALLOC_H */
include/asm/pgtable.h +8 -13
diff -ru tile.old/include/asm/pgtable.h tile/include/asm/pgtable.h
@@ -127,12 +127,7 @@
 #define PAGE_KERNEL_RO		__pgprot(_PAGE_KERNEL_RO)
 #define PAGE_KERNEL_EXEC	__pgprot(_PAGE_KERNEL_EXEC)
 
-#ifdef CONFIG_HOMECACHE
-#define page_to_kpgprot(p) \
-	(page_home(p) == PAGE_HOME_IMMUTABLE ? PAGE_KERNEL_RO : PAGE_KERNEL)
-#else
 #define page_to_kpgprot(p) PAGE_KERNEL
-#endif
 
 /*
  * We could tighten these up, but for now writable or executable
@@ -177,14 +172,14 @@
  */
 static inline void __pte_clear(pte_t *ptep)
 {
-
-
-
+#ifdef __tilegx__
+	ptep->val = 0;
+#else
 	u32 *tmp = (u32 *)ptep;
 	tmp[0] = 0;
 	barrier();
 	tmp[1] = 0;
-
+#endif
 }
 #define pte_clear(mm, addr, ptep) __pte_clear(ptep)
 
@@ -387,11 +382,11 @@
 
 #endif /* !__ASSEMBLY__ */
 
-
-
-
+#ifdef __tilegx__
+#include <asm/pgtable_64.h>
+#else
 #include <asm/pgtable_32.h>
-
+#endif
 
 #ifndef __ASSEMBLY__
 
include/asm/pgtable_32.h +10 -3
diff -ru tile.old/include/asm/pgtable_32.h tile/include/asm/pgtable_32.h
@@ -49,19 +49,26 @@
 #define LAST_PKMAP PTRS_PER_PTE
 
 #define PKMAP_BASE   ((FIXADDR_BOOT_START - PAGE_SIZE*LAST_PKMAP) & PGDIR_MASK)
+
 #ifdef CONFIG_HIGHMEM
-# define HUGE_VMAP_END	(PKMAP_BASE & ~(HPAGE_SIZE-1))
+# define __VMAPPING_END	(PKMAP_BASE & ~(HPAGE_SIZE-1))
 #else
-# define HUGE_VMAP_END	(FIXADDR_START & ~(HPAGE_SIZE-1))
+# define __VMAPPING_END	(FIXADDR_START & ~(HPAGE_SIZE-1))
 #endif
+
+#ifdef CONFIG_HUGEVMAP
+#define HUGE_VMAP_END	__VMAPPING_END
 #define HUGE_VMAP_BASE	(HUGE_VMAP_END - CONFIG_NR_HUGE_VMAPS * HPAGE_SIZE)
+#define _VMALLOC_END	HUGE_VMAP_BASE
+#else
+#define _VMALLOC_END	__VMAPPING_END
+#endif
 
 /*
  * Align the vmalloc area to an L2 page table, and leave a guard page
  * at the beginning and end.  The vmalloc code also puts in an internal
  * guard page between each allocation.
  */
-#define _VMALLOC_END	HUGE_VMAP_BASE
 #define VMALLOC_END	(_VMALLOC_END - PAGE_SIZE)
 extern unsigned long VMALLOC_RESERVE /* = CONFIG_VMALLOC_RESERVE */;
 #define _VMALLOC_START	(_VMALLOC_END - VMALLOC_RESERVE)
include/asm/posix_types.h +1 -77

78 lines not on this page · raw message

include/asm/processor.h +13 -55

139 lines not on this page · raw message

include/asm/ptrace.h +4 -4
diff -ru tile.old/include/asm/ptrace.h tile/include/asm/ptrace.h
@@ -146,10 +146,10 @@
 extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
 			 int error_code);
 
-
-
-
-
+#ifdef __tilegx__
+/* We need this since sigval_t has a user pointer in it, for GETSIGINFO etc. */
+#define __ARCH_WANT_COMPAT_SYS_PTRACE
+#endif
 
 #endif /* !__ASSEMBLY__ */
 
include/asm/sections.h +1 -2
diff -ru tile.old/include/asm/sections.h tile/include/asm/sections.h
@@ -20,8 +20,7 @@
 #include <asm-generic/sections.h>
 
 /* Text and data are at different areas in the kernel VA space. */
-extern char __init_text_begin[], __init_text_end[];
-extern char __init_data_begin[], __init_data_end[];
+extern char _sinitdata[], _einitdata[];
 
 /* Write-once data is writable only till the end of initialization. */
 extern char __w1data_begin[], __w1data_end[];
include/asm/sembuf.h +1 -42

43 lines not on this page · raw message

include/asm/setup.h +0 -2
diff -ru tile.old/include/asm/setup.h tile/include/asm/setup.h
@@ -15,7 +15,6 @@
 #ifndef _ASM_TILE_SETUP_H
 #define _ASM_TILE_SETUP_H
 
-#ifdef __KERNEL__
 #include <linux/pfn.h>
 #include <linux/init.h>
 
@@ -23,7 +22,6 @@
  * Reserved space for vmalloc and iomap - defined in asm/page.h
  */
 #define MAXMEM_PFN	PFN_DOWN(MAXMEM)
-#endif
 
 #define COMMAND_LINE_SIZE	2048
 
include/asm/shmparam.h +1 -20
diff -ru tile.old/include/asm/shmparam.h tile/include/asm/shmparam.h
@@ -1,20 +1 @@
-/*
- * Copyright 2010 Tilera Corporation. All Rights Reserved.
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation, version 2.
- *
- *   This program is distributed in the hope that it will be useful, but
- *   WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- *   NON INFRINGEMENT.  See the GNU General Public License for
- *   more details.
- */
-
-#ifndef _ASM_TILE_SHMPARAM_H
-#define _ASM_TILE_SHMPARAM_H
-
-#define SHMLBA PAGE_SIZE		 /* attach addr a multiple of this */
-
-#endif /* _ASM_TILE_SHMPARAM_H */
+#include <asm-generic/shmparam.h>
include/asm/siginfo.h +2 -1
diff -ru tile.old/include/asm/siginfo.h tile/include/asm/siginfo.h
@@ -23,7 +23,8 @@
  * Additional Tile-specific SIGILL si_codes
  */
 #define ILL_DBLFLT	(__SI_FAULT|9)	/* double fault */
+#define ILL_HARDWALL	(__SI_FAULT|10)	/* user networks hardwall violation */
 #undef NSIGILL
-#define NSIGILL		9
+#define NSIGILL		10
 
 #endif /* _ASM_TILE_SIGINFO_H */
include/asm/smp.h +2 -4
diff -ru tile.old/include/asm/smp.h tile/include/asm/smp.h
@@ -19,6 +19,7 @@
 
 #include <asm/processor.h>
 #include <linux/cpumask.h>
+#include <linux/irqreturn.h>
 
 /* Set up this tile to support receiving hypervisor messages */
 void init_messaging(void);
@@ -39,7 +40,7 @@
 void evaluate_message(int tag);
 
 /* Process an IRQ_RESCHEDULE IPI. */
-void handle_reschedule_ipi(void *token);
+irqreturn_t handle_reschedule_ipi(int irq, void *token);
 
 /* Boot a secondary cpu */
 void online_secondary(void);
@@ -87,9 +88,6 @@
 
 #endif /* !CONFIG_SMP */
 
-#ifdef CONFIG_DATAPLANE
-extern struct cpumask dataplane_map;      /* set of cpus in the dataplane */
-#endif
 
 /* Which cpus may be used as the lotar in a page table entry. */
 extern struct cpumask cpu_lotar_map;
include/asm/spinlock.h +4 -4
diff -ru tile.old/include/asm/spinlock.h tile/include/asm/spinlock.h
@@ -15,10 +15,10 @@
 #ifndef _ASM_TILE_SPINLOCK_H
 #define _ASM_TILE_SPINLOCK_H
 
-
-
-
+#ifdef __tilegx__
+#include <asm/spinlock_64.h>
+#else
 #include <asm/spinlock_32.h>
-
+#endif
 
 #endif /* _ASM_TILE_SPINLOCK_H */
include/asm/spinlock_32.h +0 -18
diff -ru tile.old/include/asm/spinlock_32.h tile/include/asm/spinlock_32.h
@@ -108,9 +108,6 @@
 {
 	u32 val = __insn_tns((int *)&rwlock->lock);
 	if (unlikely(val << _RD_COUNT_WIDTH)) {
-#ifdef __TILECC__
-#pragma frequency_hint NEVER
-#endif
 		arch_read_lock_slow(rwlock, val);
 		return;
 	}
@@ -124,9 +121,6 @@
 {
 	u32 val = __insn_tns((int *)&rwlock->lock);
 	if (unlikely(val != 0)) {
-#ifdef __TILECC__
-#pragma frequency_hint NEVER
-#endif
 		arch_write_lock_slow(rwlock, val);
 		return;
 	}
@@ -141,9 +135,6 @@
 	int locked;
 	u32 val = __insn_tns((int *)&rwlock->lock);
 	if (unlikely(val & 1)) {
-#ifdef __TILECC__
-#pragma frequency_hint NEVER
-#endif
 		return arch_read_trylock_slow(rwlock);
 	}
 	locked = (val << _RD_COUNT_WIDTH) == 0;
@@ -163,9 +154,6 @@
 	 * or active readers, we can't take the lock, so give up.
 	 */
 	if (unlikely(val != 0)) {
-#ifdef __TILECC__
-#pragma frequency_hint NEVER
-#endif
 		if (!(val & 1))
 			rwlock->lock = val;
 		return 0;
@@ -185,9 +173,6 @@
 	mb();  /* guarantee anything modified under the lock is visible */
 	val = __insn_tns((int *)&rwlock->lock);
 	if (unlikely(val & 1)) {
-#ifdef __TILECC__
-#pragma frequency_hint NEVER
-#endif
 		arch_read_unlock_slow(rwlock);
 		return;
 	}
@@ -203,9 +188,6 @@
 	mb();  /* guarantee anything modified under the lock is visible */
 	val = __insn_tns((int *)&rwlock->lock);
 	if (unlikely(val != (1 << _WR_NEXT_SHIFT))) {
-#ifdef __TILECC__
-#pragma frequency_hint NEVER
-#endif
 		arch_write_unlock_slow(rwlock, val);
 		return;
 	}
include/asm/spinlock_types.h +13 -13
diff -ru tile.old/include/asm/spinlock_types.h tile/include/asm/spinlock_types.h
@@ -19,23 +19,23 @@
 # error "please don't include this file directly"
 #endif
 
+#ifdef __tilegx__
 
+/* Low 15 bits are "next"; high 15 bits are "current". */
+typedef struct arch_spinlock {
+	unsigned int lock;
+} arch_spinlock_t;
 
+#define __ARCH_SPIN_LOCK_UNLOCKED	{ 0 }
 
+/* High bit is "writer owns"; low 31 bits are a count of readers. */
+typedef struct arch_rwlock {
+	unsigned int lock;
+} arch_rwlock_t;
 
+#define __ARCH_RW_LOCK_UNLOCKED		{ 0 }
 
-
-
-
-
-
-
-
-
-
-
-
-
+#else
 
 typedef struct arch_spinlock {
 	/* Next ticket number to hand out. */
@@ -56,5 +56,5 @@
 
 #define __ARCH_RW_LOCK_UNLOCKED		{ 0 }
 
-
+#endif
 #endif /* _ASM_TILE_SPINLOCK_TYPES_H */
include/asm/stat.h +1 -79

47 lines not on this page · raw message

include/asm/swab.h +4 -4
diff -ru tile.old/include/asm/swab.h tile/include/asm/swab.h

Lines of this file are not shown. View the raw message.

include/asm/syscalls.h +9 -3
diff -ru tile.old/include/asm/syscalls.h tile/include/asm/syscalls.h

Lines of this file are not shown. View the raw message.

include/asm/system.h +7 -12
diff -ru tile.old/include/asm/system.h tile/include/asm/system.h

Lines of this file are not shown. View the raw message.

include/asm/thread_info.h +7 -11
diff -ru tile.old/include/asm/thread_info.h tile/include/asm/thread_info.h

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Only in tile.old/include/asm: tilepci.h

include/asm/timex.h +13 -17
diff -ru tile.old/include/asm/timex.h tile/include/asm/timex.h

Lines of this file are not shown. View the raw message.

include/asm/traps.h +1 -8
diff -ru tile.old/include/asm/traps.h tile/include/asm/traps.h

Lines of this file are not shown. View the raw message.

include/asm/uaccess.h +35 -35

70 lines not on this page · raw message

include/asm/unistd.h +17 -366

383 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Only in tile.old/include/hv: drv_eeprom_intf.h Only in tile.old/include/hv: drv_gpio_intf.h Only in tile.old/include/hv: drv_hpi_intf.h Only in tile.old/include/hv: drv_i2cm_intf.h Only in tile.old/include/hv: drv_memprof_intf.h Only in tile.old/include/hv: drv_pcie_channel_intf.h Only in tile.old/include/hv: drv_pcie_common.h Only in tile.old/include/hv: drv_pcie_rctest_intf.h Only in tile.old/include/hv: drv_rshim_intf.h Only in tile.old/include/hv: drv_softuart_intf.h Only in tile.old/include/hv: drv_srom_intf.h Only in tile.old/include/hv: drv_watchdog_intf.h Only in tile.old/include/hv: drv_xgbe_impl.h Only in tile.old/include/hv: drv_xgbe_intf.h Only in tile.old/include/hv: iorpc.h
Only in tile.old/include: netio
Only in tile.old: initramfs

kernel/Makefile +3 -5
diff -ru tile.old/kernel/Makefile tile/kernel/Makefile

Lines of this file are not shown. View the raw message.

kernel/asm-offsets.c +12 -12
diff -ru tile.old/kernel/asm-offsets.c tile/kernel/asm-offsets.c

Lines of this file are not shown. View the raw message.

kernel/backtrace.c +6 -26
diff -ru tile.old/kernel/backtrace.c tile/kernel/backtrace.c

Lines of this file are not shown. View the raw message.

kernel/compat.c +33 -104

137 lines not on this page · raw message

kernel/compat_signal.c +5 -5
diff -ru tile.old/kernel/compat_signal.c tile/kernel/compat_signal.c

Lines of this file are not shown. View the raw message.

kernel/entry.S +5 -43

48 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Only in tile.old/kernel: hardwall.c

kernel/head_32.S +3 -2
diff -ru tile.old/kernel/head_32.S tile/kernel/head_32.S

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Only in tile.old/kernel: hugevmap.c
Only in tile.old/kernel: hv_drivers.c
Only in tile.old/kernel: hvglue.ld
Only in tile/kernel: hvglue.lds

kernel/intvec_32.S +12 -117

129 lines not on this page · raw message

kernel/irq.c +73 -205

278 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Only in tile.old/kernel: memprof.c

kernel/module.c +73 -73

146 lines not on this page · raw message

kernel/pci-dma.c +50 -5

55 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Only in tile.old/kernel: pci.c

kernel/proc.c +0 -508

508 lines not on this page · raw message

kernel/process.c +14 -81

95 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Only in tile.old/kernel: sections.lds

kernel/setup.c +27 -58

85 lines not on this page · raw message

kernel/signal.c +3 -168

171 lines not on this page · raw message

kernel/single_step.c +4 -3
diff -ru tile.old/kernel/single_step.c tile/kernel/single_step.c

Lines of this file are not shown. View the raw message.

kernel/smp.c +2 -6
diff -ru tile.old/kernel/smp.c tile/kernel/smp.c

Lines of this file are not shown. View the raw message.

kernel/smpboot.c +0 -24
diff -ru tile.old/kernel/smpboot.c tile/kernel/smpboot.c

Lines of this file are not shown. View the raw message.

kernel/stack.c +8 -7
diff -ru tile.old/kernel/stack.c tile/kernel/stack.c

Lines of this file are not shown. View the raw message.

kernel/sys.c +22 -278

300 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Only in tile.old/kernel: syscall_table.S

kernel/tile-desc_32.c +1 -40

41 lines not on this page · raw message

kernel/time.c +61 -126

187 lines not on this page · raw message

kernel/traps.c +16 -16
diff -ru tile.old/kernel/traps.c tile/kernel/traps.c

Lines of this file are not shown. View the raw message.

kernel/vmlinux.lds.S +42 -160

202 lines not on this page · raw message

lib/__invalidate_icache.S +12 -12
diff -ru tile.old/lib/__invalidate_icache.S tile/lib/__invalidate_icache.S

Lines of this file are not shown. View the raw message.

lib/atomic_32.c +0 -19
diff -ru tile.old/lib/atomic_32.c tile/lib/atomic_32.c

Lines of this file are not shown. View the raw message.

lib/checksum.c +38 -128

166 lines not on this page · raw message

lib/delay.c +0 -30
diff -ru tile.old/lib/delay.c tile/lib/delay.c

Lines of this file are not shown. View the raw message.

lib/exports.c +4 -3
diff -ru tile.old/lib/exports.c tile/lib/exports.c

Lines of this file are not shown. View the raw message.

lib/memchr_32.c +1 -19
diff -ru tile.old/lib/memchr_32.c tile/lib/memchr_32.c

Lines of this file are not shown. View the raw message.

lib/memcpy_32.S +0 -36
diff -ru tile.old/lib/memcpy_32.S tile/lib/memcpy_32.S

Lines of this file are not shown. View the raw message.

lib/memmove_32.c +2 -17
diff -ru tile.old/lib/memmove_32.c tile/lib/memmove_32.c

Lines of this file are not shown. View the raw message.

lib/memset_32.c +2 -52

54 lines not on this page · raw message

lib/spinlock_32.c +20 -7
diff -ru tile.old/lib/spinlock_32.c tile/lib/spinlock_32.c

Lines of this file are not shown. View the raw message.

lib/spinlock_common.h new file +64 -0

64 lines not on this page · raw message

lib/strchr_32.c +1 -18
diff -ru tile.old/lib/strchr_32.c tile/lib/strchr_32.c

Lines of this file are not shown. View the raw message.

lib/strlen_32.c +1 -13
diff -ru tile.old/lib/strlen_32.c tile/lib/strlen_32.c

Lines of this file are not shown. View the raw message.

lib/uaccess.c +0 -5
diff -ru tile.old/lib/uaccess.c tile/lib/uaccess.c

Lines of this file are not shown. View the raw message.

mm/elf.c +4 -4
diff -ru tile.old/mm/elf.c tile/mm/elf.c

Lines of this file are not shown. View the raw message.

mm/fault.c +10 -13
diff -ru tile.old/mm/fault.c tile/mm/fault.c

Lines of this file are not shown. View the raw message.

mm/homecache.c +2 -2268

2,270 lines not on this page · raw message

mm/init.c +86 -308

394 lines not on this page · raw message

mm/migrate_32.S +0 -202

202 lines not on this page · raw message

mm/mmap.c +6 -6
diff -ru tile.old/mm/mmap.c tile/mm/mmap.c

Lines of this file are not shown. View the raw message.

mm/pgtable.c +8 -8
diff -ru tile.old/mm/pgtable.c tile/mm/pgtable.c

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Only in tile.old: oprofile

Part of the diff is not shown here. View the raw message.

#105 lore raw

cover revised patch for arch/tile/ support

In reply to Chris Metcalf
Quoted 5 lines · On May 20 I wrote:

At Tilera we have been running Linux 2.6.26 on our architecture for a while and distributing the sources to our customers. We just sync'ed up our sources to 2.6.34 and would like to return it to the community more widely, so I'm hoping to take advantage of the merge window for 2.6.35 to integrate support for our architecture.

Thanks to some much-appreciated volunteer work reviewing that initial patch, I now have a revised set of patches which I would like to offer for submission to the mainline.

The largest chunk of work has been adopting the "generic" syscall ABI in asm-generic. It required some work extending it to a new architecture, particularly to support both 32- and 64-bit chips, and to support a 32-bit compat layer on the 64-bit architecture. Many thanks to Arnd Bergmann for working with me on this.

In addition, I have wised up and removed most of the driver material from this patch. They are not immediately essential for booting up Tilera Linux, and I will plan to feed the drivers back over time after this initial baseline patch has been accepted.

The patches are in eight commits, the first being the changes to the "generic" ABI. The remaining seven patches are the tile architecture code, broken up into somewhat digestible chunks.

Many thanks to the folks who took the time to review parts of the initial diffs:

Arnd Bergmann <[email protected]>
Barry Song <[email protected]>
Sam Ravnborg <[email protected]>
Thomas Gleixner <[email protected]>
Marc Gauthier <[email protected]>
Jamie Lokier <[email protected]>
and Linus for reviewing my one-line lowmem_page_address() patch :-)

Chris Metcalf (8):
Fix up the "generic" unistd.h ABI to be more useful. arch/tile: infrastructure and configuration-related files. arch/tile: header files for the Tile architecture. arch/tile: core kernel/ code.
arch/tile: the kernel/tile-desc_32.c file. arch/tile: the mm/ directory.
arch/tile: lib/ directory.
arch/tile: hypervisor console driver.

 MAINTAINERS                                 |    6 +
 arch/tile/Kbuild                            |    3 +
 arch/tile/Kconfig                           |  360 +
 arch/tile/Kconfig.debug                     |   43 +
 arch/tile/Makefile                          |   52 +
 arch/tile/configs/tile_defconfig            | 1289 +++
 arch/tile/include/arch/abi.h                |   93 +
 arch/tile/include/arch/chip.h               |   23 +
 arch/tile/include/arch/chip_tile64.h        |  252 +
 arch/tile/include/arch/chip_tilepro.h       |  252 +
 arch/tile/include/arch/interrupts.h         |   19 +
 arch/tile/include/arch/interrupts_32.h      |  304 +
 arch/tile/include/arch/sim_def.h            |  512 +
 arch/tile/include/arch/spr_def.h            |   19 +
 arch/tile/include/arch/spr_def_32.h         |  162 +
 arch/tile/include/asm/Kbuild                |    3 +
 arch/tile/include/asm/asm-offsets.h         |    1 +
 arch/tile/include/asm/atomic.h              |  159 +
 arch/tile/include/asm/atomic_32.h           |  353 +
 arch/tile/include/asm/auxvec.h              |   20 +
 arch/tile/include/asm/backtrace.h           |  193 +
 arch/tile/include/asm/bitops.h              |  126 +
 arch/tile/include/asm/bitops_32.h           |  132 +
 arch/tile/include/asm/bitsperlong.h         |   26 +
 arch/tile/include/asm/bug.h                 |    1 +
 arch/tile/include/asm/bugs.h                |    1 +
 arch/tile/include/asm/byteorder.h           |    1 +
 arch/tile/include/asm/cache.h               |   50 +
 arch/tile/include/asm/cacheflush.h          |  145 +
 arch/tile/include/asm/checksum.h            |   24 +
 arch/tile/include/asm/compat.h              |  308 +
 arch/tile/include/asm/cputime.h             |    1 +
 arch/tile/include/asm/current.h             |   31 +
 arch/tile/include/asm/delay.h               |   34 +
 arch/tile/include/asm/device.h              |    1 +
 arch/tile/include/asm/div64.h               |    1 +
 arch/tile/include/asm/dma-mapping.h         |  106 +
 arch/tile/include/asm/dma.h                 |   25 +
 arch/tile/include/asm/elf.h                 |  169 +
 arch/tile/include/asm/emergency-restart.h   |    1 +
 arch/tile/include/asm/errno.h               |    1 +
 arch/tile/include/asm/fcntl.h               |    1 +
 arch/tile/include/asm/fixmap.h              |  124 +
 arch/tile/include/asm/ftrace.h              |   20 +
 arch/tile/include/asm/futex.h               |  136 +
 arch/tile/include/asm/hardirq.h             |   47 +
 arch/tile/include/asm/highmem.h             |   73 +
 arch/tile/include/asm/homecache.h           |  125 +
 arch/tile/include/asm/hugetlb.h             |  109 +
 arch/tile/include/asm/hv_driver.h           |   60 +
 arch/tile/include/asm/hw_irq.h              |   18 +
 arch/tile/include/asm/ide.h                 |   25 +
 arch/tile/include/asm/io.h                  |  220 +
 arch/tile/include/asm/ioctl.h               |    1 +
 arch/tile/include/asm/ioctls.h              |    1 +
 arch/tile/include/asm/ipc.h                 |    1 +
 arch/tile/include/asm/ipcbuf.h              |    1 +
 arch/tile/include/asm/irq.h                 |   37 +
 arch/tile/include/asm/irq_regs.h            |    1 +
 arch/tile/include/asm/irqflags.h            |  267 +
 arch/tile/include/asm/kdebug.h              |    1 +
 arch/tile/include/asm/kexec.h               |   53 +
 arch/tile/include/asm/kmap_types.h          |   43 +
 arch/tile/include/asm/linkage.h             |   51 +
 arch/tile/include/asm/local.h               |    1 +
 arch/tile/include/asm/memprof.h             |   33 +
 arch/tile/include/asm/mman.h                |   40 +
 arch/tile/include/asm/mmu.h                 |   31 +
 arch/tile/include/asm/mmu_context.h         |  131 +
 arch/tile/include/asm/mmzone.h              |   81 +
 arch/tile/include/asm/module.h              |    1 +
 arch/tile/include/asm/msgbuf.h              |    1 +
 arch/tile/include/asm/mutex.h               |    1 +
 arch/tile/include/asm/opcode-tile.h         |   30 +
 arch/tile/include/asm/opcode-tile_32.h      | 1597 ++++
 arch/tile/include/asm/opcode-tile_64.h      | 1597 ++++
 arch/tile/include/asm/opcode_constants.h    |   26 +
 arch/tile/include/asm/opcode_constants_32.h |  480 +
 arch/tile/include/asm/opcode_constants_64.h |  480 +
 arch/tile/include/asm/page.h                |  334 +
 arch/tile/include/asm/param.h               |    1 +
 arch/tile/include/asm/pci-bridge.h          |  117 +
 arch/tile/include/asm/pci.h                 |  128 +
 arch/tile/include/asm/percpu.h              |   24 +
 arch/tile/include/asm/pgalloc.h             |  119 +
 arch/tile/include/asm/pgtable.h             |  475 +
 arch/tile/include/asm/pgtable_32.h          |  117 +
 arch/tile/include/asm/poll.h                |    1 +
 arch/tile/include/asm/posix_types.h         |    1 +
 arch/tile/include/asm/processor.h           |  339 +
 arch/tile/include/asm/ptrace.h              |  163 +
 arch/tile/include/asm/resource.h            |    1 +
 arch/tile/include/asm/scatterlist.h         |    1 +
 arch/tile/include/asm/sections.h            |   37 +
 arch/tile/include/asm/sembuf.h              |    1 +
 arch/tile/include/asm/setup.h               |   32 +
 arch/tile/include/asm/shmbuf.h              |    1 +
 arch/tile/include/asm/shmparam.h            |    1 +
 arch/tile/include/asm/sigcontext.h          |   27 +
 arch/tile/include/asm/sigframe.h            |   33 +
 arch/tile/include/asm/siginfo.h             |   30 +
 arch/tile/include/asm/signal.h              |   31 +
 arch/tile/include/asm/smp.h                 |  126 +
 arch/tile/include/asm/socket.h              |    1 +
 arch/tile/include/asm/sockios.h             |    1 +
 arch/tile/include/asm/spinlock.h            |   24 +
 arch/tile/include/asm/spinlock_32.h         |  200 +
 arch/tile/include/asm/spinlock_types.h      |   60 +
 arch/tile/include/asm/stack.h               |   68 +
 arch/tile/include/asm/stat.h                |    1 +
 arch/tile/include/asm/statfs.h              |    1 +
 arch/tile/include/asm/string.h              |   32 +
 arch/tile/include/asm/swab.h                |   29 +
 arch/tile/include/asm/syscall.h             |   79 +
 arch/tile/include/asm/syscalls.h            |   60 +
 arch/tile/include/asm/system.h              |  220 +
 arch/tile/include/asm/termbits.h            |    1 +
 arch/tile/include/asm/termios.h             |    1 +
 arch/tile/include/asm/thread_info.h         |  165 +
 arch/tile/include/asm/timex.h               |   47 +
 arch/tile/include/asm/tlb.h                 |   25 +
 arch/tile/include/asm/tlbflush.h            |  128 +
 arch/tile/include/asm/topology.h            |   85 +
 arch/tile/include/asm/traps.h               |   36 +
 arch/tile/include/asm/types.h               |    1 +
 arch/tile/include/asm/uaccess.h             |  578 ++
 arch/tile/include/asm/ucontext.h            |    1 +
 arch/tile/include/asm/unaligned.h           |   24 +
 arch/tile/include/asm/unistd.h              |   47 +
 arch/tile/include/asm/user.h                |   21 +
 arch/tile/include/asm/xor.h                 |    1 +
 arch/tile/include/hv/drv_pcie_rc_intf.h     |   38 +
 arch/tile/include/hv/hypervisor.h           | 2366 +++++
 arch/tile/include/hv/syscall_public.h       |   42 +
 arch/tile/kernel/Makefile                   |   16 +
 arch/tile/kernel/asm-offsets.c              |   76 +
 arch/tile/kernel/backtrace.c                |  634 ++
 arch/tile/kernel/compat.c                   |  183 +
 arch/tile/kernel/compat_signal.c            |  433 +
 arch/tile/kernel/early_printk.c             |  109 +
 arch/tile/kernel/entry.S                    |  141 +
 arch/tile/kernel/head_32.S                  |  180 +
 arch/tile/kernel/hvglue.lds                 |   56 +
 arch/tile/kernel/init_task.c                |   59 +
 arch/tile/kernel/intvec_32.S                | 2006 ++++
 arch/tile/kernel/irq.c                      |  227 +
 arch/tile/kernel/machine_kexec.c            |  291 +
 arch/tile/kernel/messaging.c                |  115 +
 arch/tile/kernel/module.c                   |  257 +
 arch/tile/kernel/pci-dma.c                  |  231 +
 arch/tile/kernel/proc.c                     |   91 +
 arch/tile/kernel/process.c                  |  647 ++
 arch/tile/kernel/ptrace.c                   |  203 +
 arch/tile/kernel/reboot.c                   |   52 +
 arch/tile/kernel/regs_32.S                  |  145 +
 arch/tile/kernel/relocate_kernel.S          |  280 +
 arch/tile/kernel/setup.c                    | 1497 +++
 arch/tile/kernel/signal.c                   |  359 +
 arch/tile/kernel/single_step.c              |  656 ++
 arch/tile/kernel/smp.c                      |  202 +
 arch/tile/kernel/smpboot.c                  |  293 +
 arch/tile/kernel/stack.c                    |  485 +
 arch/tile/kernel/sys.c                      |  122 +
 arch/tile/kernel/tile-desc_32.c             |13826 +++++++++++++++++++++++++++
 arch/tile/kernel/time.c                     |  220 +
 arch/tile/kernel/tlb.c                      |   97 +
 arch/tile/kernel/traps.c                    |  237 +
 arch/tile/kernel/vmlinux.lds.S              |   98 +
 arch/tile/lib/Makefile                      |   16 +
 arch/tile/lib/__invalidate_icache.S         |  106 +
 arch/tile/lib/atomic_32.c                   |  347 +
 arch/tile/lib/atomic_asm_32.S               |  197 +
 arch/tile/lib/checksum.c                    |  102 +
 arch/tile/lib/cpumask.c                     |   51 +
 arch/tile/lib/delay.c                       |   34 +
 arch/tile/lib/exports.c                     |   78 +
 arch/tile/lib/mb_incoherent.S               |   34 +
 arch/tile/lib/memchr_32.c                   |   68 +
 arch/tile/lib/memcpy_32.S                   |  628 ++
 arch/tile/lib/memcpy_tile64.c               |  271 +
 arch/tile/lib/memmove_32.c                  |   63 +
 arch/tile/lib/memset_32.c                   |  274 +
 arch/tile/lib/spinlock_32.c                 |  221 +
 arch/tile/lib/spinlock_common.h             |   64 +
 arch/tile/lib/strchr_32.c                   |   66 +
 arch/tile/lib/strlen_32.c                   |   36 +
 arch/tile/lib/uaccess.c                     |   31 +
 arch/tile/lib/usercopy_32.S                 |  223 +
 arch/tile/mm/Makefile                       |    9 +
 arch/tile/mm/elf.c                          |  164 +
 arch/tile/mm/extable.c                      |   30 +
 arch/tile/mm/fault.c                        |  905 ++
 arch/tile/mm/highmem.c                      |  328 +
 arch/tile/mm/homecache.c                    |  445 +
 arch/tile/mm/hugetlbpage.c                  |  343 +
 arch/tile/mm/init.c                         | 1082 +++
 arch/tile/mm/migrate.h                      |   50 +
 arch/tile/mm/migrate_32.S                   |  211 +
 arch/tile/mm/mmap.c                         |   75 +
 arch/tile/mm/pgtable.c                      |  566 ++
 drivers/char/Makefile                       |    1 +
 drivers/char/hvc_tile.c                     |   67 +
 include/asm-generic/unistd.h                |   26 +-
 include/linux/syscalls.h                    |    4 +
 204 files changed, 49504 insertions(+), 6 deletions(-)
 create mode 100644 arch/tile/Kbuild
 create mode 100644 arch/tile/Kconfig
 create mode 100644 arch/tile/Kconfig.debug
 create mode 100644 arch/tile/Makefile
 create mode 100644 arch/tile/configs/tile_defconfig
 create mode 100644 arch/tile/include/arch/abi.h
 create mode 100644 arch/tile/include/arch/chip.h
 create mode 100644 arch/tile/include/arch/chip_tile64.h
 create mode 100644 arch/tile/include/arch/chip_tilepro.h
 create mode 100644 arch/tile/include/arch/interrupts.h
 create mode 100644 arch/tile/include/arch/interrupts_32.h
 create mode 100644 arch/tile/include/arch/sim_def.h
 create mode 100644 arch/tile/include/arch/spr_def.h
 create mode 100644 arch/tile/include/arch/spr_def_32.h
 create mode 100644 arch/tile/include/asm/Kbuild
 create mode 100644 arch/tile/include/asm/asm-offsets.h
 create mode 100644 arch/tile/include/asm/atomic.h
 create mode 100644 arch/tile/include/asm/atomic_32.h
 create mode 100644 arch/tile/include/asm/auxvec.h
 create mode 100644 arch/tile/include/asm/backtrace.h
 create mode 100644 arch/tile/include/asm/bitops.h
 create mode 100644 arch/tile/include/asm/bitops_32.h
 create mode 100644 arch/tile/include/asm/bitsperlong.h
 create mode 100644 arch/tile/include/asm/bug.h
 create mode 100644 arch/tile/include/asm/bugs.h
 create mode 100644 arch/tile/include/asm/byteorder.h
 create mode 100644 arch/tile/include/asm/cache.h
 create mode 100644 arch/tile/include/asm/cacheflush.h
 create mode 100644 arch/tile/include/asm/checksum.h
 create mode 100644 arch/tile/include/asm/compat.h
 create mode 100644 arch/tile/include/asm/cputime.h
 create mode 100644 arch/tile/include/asm/current.h
 create mode 100644 arch/tile/include/asm/delay.h
 create mode 100644 arch/tile/include/asm/device.h
 create mode 100644 arch/tile/include/asm/div64.h
 create mode 100644 arch/tile/include/asm/dma-mapping.h
 create mode 100644 arch/tile/include/asm/dma.h
 create mode 100644 arch/tile/include/asm/elf.h
 create mode 100644 arch/tile/include/asm/emergency-restart.h
 create mode 100644 arch/tile/include/asm/errno.h
 create mode 100644 arch/tile/include/asm/fcntl.h
 create mode 100644 arch/tile/include/asm/fixmap.h
 create mode 100644 arch/tile/include/asm/ftrace.h
 create mode 100644 arch/tile/include/asm/futex.h
 create mode 100644 arch/tile/include/asm/hardirq.h
 create mode 100644 arch/tile/include/asm/highmem.h
 create mode 100644 arch/tile/include/asm/homecache.h
 create mode 100644 arch/tile/include/asm/hugetlb.h
 create mode 100644 arch/tile/include/asm/hv_driver.h
 create mode 100644 arch/tile/include/asm/hw_irq.h
 create mode 100644 arch/tile/include/asm/ide.h
 create mode 100644 arch/tile/include/asm/io.h
 create mode 100644 arch/tile/include/asm/ioctl.h
 create mode 100644 arch/tile/include/asm/ioctls.h
 create mode 100644 arch/tile/include/asm/ipc.h
 create mode 100644 arch/tile/include/asm/ipcbuf.h
 create mode 100644 arch/tile/include/asm/irq.h
 create mode 100644 arch/tile/include/asm/irq_regs.h
 create mode 100644 arch/tile/include/asm/irqflags.h
 create mode 100644 arch/tile/include/asm/kdebug.h
 create mode 100644 arch/tile/include/asm/kexec.h
 create mode 100644 arch/tile/include/asm/kmap_types.h
 create mode 100644 arch/tile/include/asm/linkage.h
 create mode 100644 arch/tile/include/asm/local.h
 create mode 100644 arch/tile/include/asm/memprof.h
 create mode 100644 arch/tile/include/asm/mman.h
 create mode 100644 arch/tile/include/asm/mmu.h
 create mode 100644 arch/tile/include/asm/mmu_context.h
 create mode 100644 arch/tile/include/asm/mmzone.h
 create mode 100644 arch/tile/include/asm/module.h
 create mode 100644 arch/tile/include/asm/msgbuf.h
 create mode 100644 arch/tile/include/asm/mutex.h
 create mode 100644 arch/tile/include/asm/opcode-tile.h
 create mode 100644 arch/tile/include/asm/opcode-tile_32.h
 create mode 100644 arch/tile/include/asm/opcode-tile_64.h
 create mode 100644 arch/tile/include/asm/opcode_constants.h
 create mode 100644 arch/tile/include/asm/opcode_constants_32.h
 create mode 100644 arch/tile/include/asm/opcode_constants_64.h
 create mode 100644 arch/tile/include/asm/page.h
 create mode 100644 arch/tile/include/asm/param.h
 create mode 100644 arch/tile/include/asm/pci-bridge.h
 create mode 100644 arch/tile/include/asm/pci.h
 create mode 100644 arch/tile/include/asm/percpu.h
 create mode 100644 arch/tile/include/asm/pgalloc.h
 create mode 100644 arch/tile/include/asm/pgtable.h
 create mode 100644 arch/tile/include/asm/pgtable_32.h
 create mode 100644 arch/tile/include/asm/poll.h
 create mode 100644 arch/tile/include/asm/posix_types.h
 create mode 100644 arch/tile/include/asm/processor.h
 create mode 100644 arch/tile/include/asm/ptrace.h
 create mode 100644 arch/tile/include/asm/resource.h
 create mode 100644 arch/tile/include/asm/scatterlist.h
 create mode 100644 arch/tile/include/asm/sections.h
 create mode 100644 arch/tile/include/asm/sembuf.h
 create mode 100644 arch/tile/include/asm/setup.h
 create mode 100644 arch/tile/include/asm/shmbuf.h
 create mode 100644 arch/tile/include/asm/shmparam.h
 create mode 100644 arch/tile/include/asm/sigcontext.h
 create mode 100644 arch/tile/include/asm/sigframe.h
 create mode 100644 arch/tile/include/asm/siginfo.h
 create mode 100644 arch/tile/include/asm/signal.h
 create mode 100644 arch/tile/include/asm/smp.h
 create mode 100644 arch/tile/include/asm/socket.h
 create mode 100644 arch/tile/include/asm/sockios.h
 create mode 100644 arch/tile/include/asm/spinlock.h
 create mode 100644 arch/tile/include/asm/spinlock_32.h
 create mode 100644 arch/tile/include/asm/spinlock_types.h
 create mode 100644 arch/tile/include/asm/stack.h
 create mode 100644 arch/tile/include/asm/stat.h
 create mode 100644 arch/tile/include/asm/statfs.h
 create mode 100644 arch/tile/include/asm/string.h
 create mode 100644 arch/tile/include/asm/swab.h
 create mode 100644 arch/tile/include/asm/syscall.h
 create mode 100644 arch/tile/include/asm/syscalls.h
 create mode 100644 arch/tile/include/asm/system.h
 create mode 100644 arch/tile/include/asm/termbits.h
 create mode 100644 arch/tile/include/asm/termios.h
 create mode 100644 arch/tile/include/asm/thread_info.h
 create mode 100644 arch/tile/include/asm/timex.h
 create mode 100644 arch/tile/include/asm/tlb.h
 create mode 100644 arch/tile/include/asm/tlbflush.h
 create mode 100644 arch/tile/include/asm/topology.h
 create mode 100644 arch/tile/include/asm/traps.h
 create mode 100644 arch/tile/include/asm/types.h
 create mode 100644 arch/tile/include/asm/uaccess.h
 create mode 100644 arch/tile/include/asm/ucontext.h
 create mode 100644 arch/tile/include/asm/unaligned.h
 create mode 100644 arch/tile/include/asm/unistd.h
 create mode 100644 arch/tile/include/asm/user.h
 create mode 100644 arch/tile/include/asm/xor.h
 create mode 100644 arch/tile/include/hv/drv_pcie_rc_intf.h
 create mode 100644 arch/tile/include/hv/hypervisor.h
 create mode 100644 arch/tile/include/hv/syscall_public.h
 create mode 100644 arch/tile/kernel/Makefile
 create mode 100644 arch/tile/kernel/asm-offsets.c
 create mode 100644 arch/tile/kernel/backtrace.c
 create mode 100644 arch/tile/kernel/compat.c
 create mode 100644 arch/tile/kernel/compat_signal.c
 create mode 100644 arch/tile/kernel/early_printk.c
 create mode 100644 arch/tile/kernel/entry.S
 create mode 100644 arch/tile/kernel/head_32.S
 create mode 100644 arch/tile/kernel/hvglue.lds
 create mode 100644 arch/tile/kernel/init_task.c
 create mode 100644 arch/tile/kernel/intvec_32.S
 create mode 100644 arch/tile/kernel/irq.c
 create mode 100644 arch/tile/kernel/machine_kexec.c
 create mode 100644 arch/tile/kernel/messaging.c
 create mode 100644 arch/tile/kernel/module.c
 create mode 100644 arch/tile/kernel/pci-dma.c
 create mode 100644 arch/tile/kernel/proc.c
 create mode 100644 arch/tile/kernel/process.c
 create mode 100644 arch/tile/kernel/ptrace.c
 create mode 100644 arch/tile/kernel/reboot.c
 create mode 100644 arch/tile/kernel/regs_32.S
 create mode 100644 arch/tile/kernel/relocate_kernel.S
 create mode 100644 arch/tile/kernel/setup.c
 create mode 100644 arch/tile/kernel/signal.c
 create mode 100644 arch/tile/kernel/single_step.c
 create mode 100644 arch/tile/kernel/smp.c
 create mode 100644 arch/tile/kernel/smpboot.c
 create mode 100644 arch/tile/kernel/stack.c
 create mode 100644 arch/tile/kernel/sys.c
 create mode 100644 arch/tile/kernel/tile-desc_32.c
 create mode 100644 arch/tile/kernel/time.c
 create mode 100644 arch/tile/kernel/tlb.c
 create mode 100644 arch/tile/kernel/traps.c
 create mode 100644 arch/tile/kernel/vmlinux.lds.S
 create mode 100644 arch/tile/lib/Makefile
 create mode 100644 arch/tile/lib/__invalidate_icache.S
 create mode 100644 arch/tile/lib/atomic_32.c
 create mode 100644 arch/tile/lib/atomic_asm_32.S
 create mode 100644 arch/tile/lib/checksum.c
 create mode 100644 arch/tile/lib/cpumask.c
 create mode 100644 arch/tile/lib/delay.c
 create mode 100644 arch/tile/lib/exports.c
 create mode 100644 arch/tile/lib/mb_incoherent.S
 create mode 100644 arch/tile/lib/memchr_32.c
 create mode 100644 arch/tile/lib/memcpy_32.S
 create mode 100644 arch/tile/lib/memcpy_tile64.c
 create mode 100644 arch/tile/lib/memmove_32.c
 create mode 100644 arch/tile/lib/memset_32.c
 create mode 100644 arch/tile/lib/spinlock_32.c
 create mode 100644 arch/tile/lib/spinlock_common.h
 create mode 100644 arch/tile/lib/strchr_32.c
 create mode 100644 arch/tile/lib/strlen_32.c
 create mode 100644 arch/tile/lib/uaccess.c
 create mode 100644 arch/tile/lib/usercopy_32.S
 create mode 100644 arch/tile/mm/Makefile
 create mode 100644 arch/tile/mm/elf.c
 create mode 100644 arch/tile/mm/extable.c
 create mode 100644 arch/tile/mm/fault.c
 create mode 100644 arch/tile/mm/highmem.c
 create mode 100644 arch/tile/mm/homecache.c
 create mode 100644 arch/tile/mm/hugetlbpage.c
 create mode 100644 arch/tile/mm/init.c
 create mode 100644 arch/tile/mm/migrate.h
 create mode 100644 arch/tile/mm/migrate_32.S
 create mode 100644 arch/tile/mm/mmap.c
 create mode 100644 arch/tile/mm/pgtable.c
 create mode 100644 drivers/char/hvc_tile.c